Part 53 to 55 Talking about Reflection in C#
2024-09-22 03:50:01
Part 53 Reflection in C#
Part 54 Reflection Example
here is the code
private void btnDiscover_Click(object sender, EventArgs e)
{
lbMethods.Items.Clear();
lbProperties.Items.Clear();
lbConstructor.Items.Clear();
string typeName = txtTypeName.Text.Trim();
Type t = Type.GetType(typeName);
if (t == null)
{
MessageBox.Show("Type Is No Exit, Please Enter A Right Type!", "Warnning", MessageBoxButtons.OK);
txtTypeName.Clear();
txtTypeName.Focus();
}
else
{
MethodInfo[] methods = t.GetMethods();
PropertyInfo[] properties = t.GetProperties();
ConstructorInfo[] constructors = t.GetConstructors();
foreach (var method in methods)
{
lbMethods.Items.Add(string.Concat(method.ReturnType.Name," ", method.Name));
}
foreach (var property in properties)
{
lbProperties.Items.Add(string.Concat(property.PropertyType.Name, " ", property.Name));
}
foreach (var constructor in constructors)
{
lbConstructor.Items.Add(constructor.ToString());
}
}
}
Part 55 Late binding using reflection
最新文章
- win7自动登录桌面
- paper 23 :Kullback–Leibler divergence KL散度(2)
- JDE910笔记1--基础介绍及配置[转]
- Codeforces Round #130 (Div. 2)
- 无法完成安装:'unsupported configuration: hda-duplex not supported in this QEMU binary'
- 关于mysql 连接数
- Haproxy均衡负载部署和配置文件详解
- ECMAScript 5中新增的数组方法
- java开发中的链式思维 —— 设计一个链式过滤器
- .NET链接Oracle 参数绑定问题
- php5.3命名空间内使用 php内置类的时候
- Android必知必会-Handler可能引起的内存泄露
- Redis(1)---五种数据结构
- 转://Linux大内存页Oracle数据库优化
- Mac mumu模拟器设置代理
- 超恶心的TP模版取值
- Digital biquad filter
- System.ArgumentException: 目标数组的长度不够。请检查 destIndex 和长度以及数组的下限
- js数据结构之列表的详细实现方法
- 如何启动、关闭和设置ubuntu防火墙