When can c# support loop objects? like javascript. #2552
-
class Person{ you can see in this url https://github.com/dotnet/coreclr/issues/24677 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I see absolutely nothing wrong with Ben Adams suggested extension method at https://github.com/dotnet/coreclr/issues/24677#issuecomment-494341978. Why do you feel this requires language support? |
Beta Was this translation helpful? Give feedback.
-
You can to use reflection class Program
{
static void Main(string[] args)
{
var person = new Person() { ID = 1, Name = "test" };
foreach (var property in person.GetType().GetProperties())
{
Console.WriteLine("property: " + property.Name + ", value: " + property.GetValue(person));
}
}
}
class Person
{
public int ID { get; set; }
public string Name { get; set; }
} |
Beta Was this translation helpful? Give feedback.
I see absolutely nothing wrong with Ben Adams suggested extension method at https://github.com/dotnet/coreclr/issues/24677#issuecomment-494341978. Why do you feel this requires language support?