示例#1
0
        static void ConstructFromSerializedType <TValue>(ref TValue value, Type type, ISerializedTypeProvider provider)
        {
            if (type.IsArray)
            {
                var count = provider.GetArrayLength();
                value = TypeConstruction.ConstructArray <TValue>(type, count);
                return;
            }

            if (null != value && value.GetType() == type)
            {
                return;
            }

            value = TypeConstruction.Construct <TValue>(type);
        }
示例#2
0
        static void ConstructFromDeclaredType <TValue>(ref TValue value, ISerializedTypeProvider provider)
        {
            if (typeof(TValue).IsArray)
            {
                var count = provider.GetArrayLength();

                if (null == value || (value as Array)?.Length != count)
                {
                    value = TypeConstruction.ConstructArray <TValue>(count);
                    return;
                }

                return;
            }

            if (null == value)
            {
                value = TypeConstruction.Construct <TValue>();
            }
        }
 void ReloadWithArrayType()
 {
     ReloadWithInstance(TypeConstruction.ConstructArray <T>());
 }