Get Value from FieldInfo - CSharp System.Reflection

CSharp examples for System.Reflection:FieldInfo

Description

Get Value from FieldInfo

Demo Code


using System.Reflection;
using System.Collections.Generic;
using System;/*w w w . j a v a2  s  .com*/

public class Main{
        public static object GetValue(FieldInfo field, object @object)
        {
            object value = field.GetValue(@object);
            return (field.FieldType.IsEnum) ? (int) value : value;            
        }
}

Related Tutorials