Tag: reflection
How to set a property value by reflection in C# ?
There are times when you want to set the property of an object using reflection in C#. Below is a sample code snippet demonstrating how to do it taking the Employee class as an example and Name as the property. How to set a property value by reflection in C# ?
How to Get the Name of the Anonymous class(type) in C# ?
Below is a sample code snippet which gets the name of the anonymous class . In the below example , the Name and the ID property is set which is anonymous where the type is not specified. When trying to find out the type of the anonymous type , you will get the type as shown in the screenshot below. How to Get the Name…
How to Get the Property value using reflection in C# ?
Below is a sample method that demonstrates how to retrieve the property value in C# using reflection. How to Get the Property value using reflection in C# ?