Is there a built-in .NET method for getting all of the properties and values for an object?
Posted
by Ben McCormack
on Stack Overflow
See other posts from Stack Overflow
or by Ben McCormack
Published on 2010-04-28T15:13:11Z
Indexed on
2010/04/28
15:33 UTC
Read the original article
Hit count: 279
Let's say I have:
public class Item
{
public string SKU {get; set; }
public string Description {get; set; }
}
....
Is there a built-in method in .NET that will let me get the properties and values for variable i
of type Item
that might look like this:
{SKU: "123-4556", Description: "Millennial Radio Classic"}
I know that .ToString()
can be overloaded to provide this functionaility, but I couldn't remember if this was already provided in .NET.
© Stack Overflow or respective owner