我有一个方法返回操作系统属性列表.我想循环遍历属性并对每个属性进行一些处理.所有属性都是字符串
我如何循环对象
C#
// test1 and test2 so you can see a simple example of the properties - although these are not part of the question
String test1 = OS_Result.OSResultStruct.OSBuild;
String test2 = OS_Result.OSResultStruct.OSMajor;
// here is what i would like to be able to do
foreach (string s in OS_Result.OSResultStruct)
{
// get the string and do some work....
string test = s;
//......
}
Run Code Online (Sandbox Code Playgroud)