子属性能赋值,又怎么获取属性的子属性的值呢
解决方案 »
- vs2010神秘问题
- 帮忙解决下C#中画图问题
- 郁闷又是老问题,如何不获取重复的值
- C# Winform 下有时在form的控件上点一下程序会死掉,请各位帮忙,谢谢!
- EndExecuteNonQuery 方法没有采用“0”个参数的重载
- 硬盘坏了,请问那里有VS2003+MSDN高速下载?谢谢
- 高分跪求:webClient DownloadFile 如何突破Proxy?
- 关于添加引用的问题(winform)
- 大侠救命,关于用.NET调用COM接口方法?我现在只有70分,全部给了!
- 怎么样才能得到网站的应用的绝对路径;希望高手指点迷津;
- C#定义Class的问题
- 用SQL2008做了一个登陆界面,注册,登陆没问题,但是登陆时密码输入次数不增加,求解!
{
public B b { get; set; }
}
class B
{
public string Name { get; set; }
}foreach (var item in typeof(A).GetPropertites())
{
Console.WriteLine(item.PropertyType + " " + item.Name);
foreach (var i2 in PropertyType.GetPropertites())
{
Console.WriteLine("\t" + i2.Name);
}
}
{
public B b { get; set; }
}
class B
{
public string Name { get; set; }
}A a = new A();
a.b = new B() { Name = "123" };objb = a.GetType().GetProperty("b").GetValue(a, null);
string s = (string)a.GetType().GetProperty("b").PropertyType.GetProperty("Name").GetValue(objb, null);
我对Name赋值后
然后这样写 i2.getvalue(item,null); //这里会报错误,说对象和类型不匹配
i2.getvalue(object obj,null) 这里的obj应该怎么写呢