.NET Reflection 相关类型与枚举详解
在 .NET 开发中,反射是一项强大的功能,它允许程序在运行时获取类型的信息并进行操作。下面将详细介绍 .NET 中一些与反射相关的类型和枚举。
1. DefaultMemberAttribute
DefaultMemberAttribute 允许指定类的默认成员,通常是索引器。不过,C# 语言本身不允许使用默认成员,而其他 .NET 语言(如 VB.NET)则支持。
public sealed class DefaultMemberAttribute : Attribute {
// Public Constructors
public DefaultMemberAttribute(string memberName);
// Public Instance Properties
public string MemberName { get; }
}
该类的继承层次结构如下:
graph LR
A[System.Object] --> B[System.Attribute]
B --> C[DefaultMemberAttribute]
DefaultMemberAttribute 可应用于类、结构体和接口。
超级会员免费看
订阅专栏 解锁全文
80

被折叠的 条评论
为什么被折叠?



