Answers for "foreach c# object"

C#
0

for each property in object c#

foreach (PropertyInfo propertyInfo in obj.GetType().GetProperties())
{
   // do stuff here
}
Posted by: Guest on April-24-2020
0

c# foreach on a dictionary

foreach(var item in myDictionary)
{
  foo(item.Key);
  bar(item.Value);
}
Posted by: Guest on March-19-2021

C# Answers by Framework

Browse Popular Code Answers by Language