0
检查了这一点解析值到类型类型的
Type configPropType = configurableProp.getPropertyType();
string attValue = xmlelement.GetAttribute(configurableProp.getName());
configProps[configurableProp.getName()] = attValue;
点在哪里我设置它原来的分配对象,得到了来自XML阅读价值为它工作。我需要类似的东西。
configProps[configurableProp.getName()] = configPropType.ParseToThisType(attValue);
找遍了msdn,但它是一个非常混乱的地方。
完美。这是一个挑战,不知道 - 什么搜索条件会找到你在MSDN上的答案? – DrLazer 2010-05-12 14:00:32
我不会使用搜索术语 - 我将学习.NET Framework基础知识,其中将包括Convert类。我还会学习.NET中的属性如何工作,所以我的代码看起来像'configurableProp.Name'而不是'configurableProp.getName()' – 2010-05-12 14:14:31
这是有用的John。我特别使用函数来获取我不想保存到XML的东西,并保留公共Getters以反射方式保存数据。不幸的是,我们并非都有时间成为46k + – DrLazer 2010-05-12 14:51:13