CSharp examples for System.Reflection:PropertyInfo
Set Property Value
using System.Reflection; using System.Linq; using System;/*from www . j av a2 s. c o m*/ public class Main{ public static void SetPropertyValue(object entity, string propertyName, object value) { Type type = entity.GetType(); PropertyInfo propertyInfo = type.GetProperty(propertyName, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.IgnoreCase); propertyInfo.SetValue(entity,value,null); } }