Answers for "c# get value from object"

C#
0

c# get property using string

public static object GetPropValue(object src, string propName)
 {
     return src.GetType().GetProperty(propName).GetValue(src, null);
 }
Posted by: Guest on July-07-2020
1

how to get value from object in c#

var nameOfProperty = "property1";
var propertyInfo = myObject.GetType().GetProperty(nameOfProperty);
var value = propertyInfo.GetValue(myObject, null);
Posted by: Guest on November-21-2019

Code answers related to "c# get value from object"

C# Answers by Framework

Browse Popular Code Answers by Language