Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
一个新手 vb.net 问题
在类中定义结构(将其命名为 X)并在该类中创建类型为 X 的属性有什么副作用?
没有副作用。
唯一的影响是结构在类的范围内,也就是说,如果您想从类外部使用范围,则必须将其声明为,并且您需要在使用它时Public明确限定名称。OuterClassName.InnerStructureName
Public
OuterClassName.InnerStructureName
值得注意的是(与 Java 不同),该结构与它所包含的类的任何实例都不相关。因此它不能只访问其周围类的实例成员。