GetFieldInfo() public static method

public static GetFieldInfo ( Type type ) : FieldInfo
type System.Type
return FieldInfo
Beispiel #1
0
        public override Field CopyField()
        {
            var fldinfo = InfoProvider.GetFieldInfo(GetType());
            var other   = fldinfo.CreateInstance();

            var compinfo = InfoProvider.GetCompoundInfo(GetType());

            compinfo.Copy(this, other);
            return(other);
        }
Beispiel #2
0
        public Compound()
        {
            // Initialize fields that should not be null
            var members = InfoProvider.GetCompoundInfo(GetType()).Members;

            foreach (var meminfo in members.Values.Distinct().Where(m => m.Initialize))
            {
                if (meminfo.IsListType)
                {
                    // Instantiate list field
                    meminfo.EnsureListCreated(this);
                }
                else if (!meminfo.IsPrimitiveType)
                {
                    // Instantiate complex fields
                    var fieldinfo = InfoProvider.GetFieldInfo(meminfo.FieldType);
                    meminfo.SetValue(this, fieldinfo.CreateInstance());
                }
            }
        }