If I have a class called sample, is there a way(Common) of retrieving "sample" as a string?
- public class sample
- {
- public int MyProperty { get; set; }
- public int MyProperty2 { get; set; }
- public string MyProperty3 { get; set; }
- }
- sample sampleClass = new sample();
- List<sample> sampleClassList = new List<sample>();
- var name = sampleClass.GetType().Name;
- var name2 = sampleClassList.GetType().Name;
In here class object class name correct but list object not get. is there any common way to get class name of object (List and Class)