一个程序集的一个类中定义了一个范型属性:List<stirng> Member;我用反射加载该程序集获取该类型的定义后,如何把该属性的名称输出为:List<stirng> 呢?
解决方案 »
- c#里想把"中国"转换成 "\u4E2D\u56FD"这样的不知道怎么写!
- 如何彻底消毁IHTMLDOMNode及其所包含对象?
- 等待时间
- c# 中的webbrowser 在设计模式下如何改变行距 !在线等待!
- Hashtable里面能不能存放struct的内容?
- 领导要我义务献血, 没休息, 没报酬, 班照加, 任务不减, 您会去吗? 怎么退托给个法吧.
- 用.net 收 ms exchage server 的邮件
- 水晶报表10 和vs 2005 自带的水晶报表有什么区别,还是一样的?
- 关于控制Backup Utility备份的问题
- 请教:C#如何运行其它程序?
- 双引号转义问题
- 如何替换word中书签的内容
Type t=Assembly.Gettype("命名空间.类名")
PropertyInfo[] pro = t.GetProperties();
foreach (PropertyInfo p in pro)
{
Console.WriteLine( p.PropertyType);
}
private static readonly string path = ConfigurationManager.AppSettings["FactoryKey"].ToString(); public static IAdbanner CreateAdbanner()
{
string classname = path + ".Adbanner";
return (IAdbanner)System.Reflection.Assembly.Load(path).CreateInstance(classname);
}
{
Console.WriteLine(item.Name);
foreach (var attrs in item.GetProperties())
{
Console.WriteLine("\t" + attrs.PropertyType + " " + attrs.Name);
}
}
PropertyInfo[] pro = t.GetProperties(); PropertyInfo p = t.GetProperty("Member"); string typeName = p.PropertyType.ToString();
Microsoft.CSharp.CSharpCodeProvider ccp = new Microsoft.CSharp.CSharpCodeProvider();
System.CodeDom.CodeTypeReference newCodeTypeReference = new System.CodeDom.CodeTypeReference(typeName);
Console.WriteLine(ccp.GetTypeOutput(newCodeTypeReference));
public class Base
{
public void AA()
{
Type type = this. GetType();
string aaa = type.Name;
}
}public class Child:Base
{
this.a();
}