Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

C# look through object

// Obtain a list of properties of string type
var stringProps = OS_Result
    .OSResultStruct
    .GetType()
    .GetProperties()
    .Where(p => p.PropertyType == typeof(string));
foreach (var prop in stringProps) {
    // Use the PropertyInfo object to extract the corresponding value
    // from the OS_Result.OSResultStruct object
    string val = (string)prop.GetValue(OS_Result.OSResultStruct);
    ...
}
Comment

C# look through object

// 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;
    //......

}
Comment

PREVIOUS NEXT
Code Example
Csharp :: WixSharp-FirewallException 
Csharp :: struct 
Csharp :: c# dictionary contain key but returns false 
Csharp :: c# how to start an application and detect if started 
Csharp :: grass download for unityh 
Csharp :: displaying list in gameobject Unity 
Csharp :: connection string of bulk insert with csv in c# 
Csharp :: Web forms switch page 
Csharp :: tuples in c# 
Csharp :: asp validator check if textbox is empty 
Csharp :: how to define a static color resource in xaml wpf 
Csharp :: c# array accessor 
Csharp :: linq pick random element 
Csharp :: c# windows form BalloonTipIcon close 
Csharp :: new bitmap pixel format c# 
Csharp :: partial mvc 
Csharp :: maximum sum of non-adjacent 
Csharp :: var c# 
Csharp :: thread c# 
Csharp :: leantween move ui 
Csharp :: unity audio source playoneshot 
Csharp :: how to scale text from center in unity 
Csharp :: how to show error xtramessagebox in devexpress c# 
Html :: lodash cdn 
Html :: p5 cdn 
Html :: font awesome linkedin 
Html :: bootstrap 5 overflow 
Html :: lorum picsum 
Html :: accepts only audio file in html 
Html :: html shell 
ADD CONTENT
Topic
Content
Source link
Name
4+7 =