nested type
嵌套类型
2026-03-21 21:59 浏览次数 13
嵌套类型
nested types are useful when the declaring type uses and creates instances of the nested type, and use of the nested type is not exposed in public members.
在声明类型使用和创建嵌套类型实例时,嵌套类型很有用,但不在公共成员中公开嵌套类型的使用。
how do you query a nested type field from a record set returned from a function?
如何查询一个嵌套类型从从函数返回一个记录集字段?。
a nested type argument is a type argument that is also a generic type.
巢状型别引数就是也是泛型型别的型别引数。
another way of saying this is that in reflection, a nested type that is defined using these languages includes the type parameters of all its enclosing types.
换句话说就是在反射中,使用这些语言定义的嵌套类型包括其所有封闭类型的类型参数。
class designer can display nested types but not the relationships between a nested type and other types.
可以显示巢状结构的型别,但无法显示巢状结构型别和其他型别之间的关系。
the accessibility domain of a nested type is at least the program text of the type in which it is declared.
巢状型别的存取范围定义域至少包含其宣告之型别的程式内容。
in general, a nested type should not perform tasks for types other than its declaring type.
一般来说,巢状型别不应该针对非其宣告型别以外的型别执行工作。
the only exception to this is when variables of the nested type need to be declared in rare scenarios such as subclassing or other advanced customization scenarios.
唯一的特例是需要声明嵌套类型的变量的情况,在生成子类或其他高级自定义等极少数情况下需要声明嵌套类型的变量。
a nested type is a type that is a member of some other type.
嵌套类型是作为某其他类型的成员的类型。
because a nested type is treated as a member of the declaring type, the nested type has access to all other members in the declaring type.
由于嵌套类型被视为是声明类型的成员,因此嵌套类型可以访问声明类型中的所有其他成员。
a nested type is a type declared within the scope of another type.
嵌套类型是在另一个类型的范围中声明的类型。
if a nested type has a public constructor, this would indicate that the type has some use separate from its declaring type.
如果巢状型别有公用建构函式,这表示此型别的某些使用与它的宣告型别不同。
two refactorings, convert anonymous class to nested and convert nested type to top level, are similar in that they move a class out of its current to scope to the enclosing scope.
convertanonymousclass(转换匿名类)和convertnested type(转换嵌套类)这两种重构方法比较相似,它们都将某个类从其当前范围移动到包含这个类的范围上。
if a nested type is generic, this method returns its generic type definition.
如果嵌套类型为泛型,则此方法返回其泛型类型定义。
you will have a compile-time error something like: 「the nested type person cannot hide an enclosing type」.
否则将会导致一个编译时间错误,如 「该嵌套类型person无法隐藏封闭类型」。
the accessibility domain of a nested type never exceeds that of the containing type.
嵌套类型的可访问域决不能超出包含类型的可访问域。
describes prohibited edits of nested type declarations.
说明巢状型别宣告所禁止的编辑。
however, the accessibility domain of a nested type cannot exceed that of the containing type.
但是,嵌套类型的可访问域不能超出包含类型的可访问域。
if you do not intend the nested type to be externally visible, change the type's accessibility.
如果您不想让巢状型别变成外部可见,请变更型别的存取范围。
do use nested types when the relationship between the nested type and its outer type is such that member accessibility semantics are desirable.
如果嵌套类型和其外部类型之间的关系需要成员可访问性语义,则要使用嵌套类型。