Пример #1
0
        /// <summary>모델 객체로부터 AZData를 생성</summary>
        /// <param name="source">AZData로 변경할 모델 객체</param>
        public static AZData From <T>(T source)
        {
            AZData rtnValue = new AZData();

#if NET_STD || NET_CORE || NET_STORE
            Type type = typeof(T);
            IEnumerable <PropertyInfo> properties = type.GetRuntimeProperties();
            foreach (PropertyInfo property in properties)
            {
                if (!property.CanRead)
                {
                    continue;
                }
                rtnValue.Add(property.Name, property.Name.Equals("SyncRoot") ? property.GetValue(source, null).ToString() : property.GetValue(source, null));
            }
#endif
#if NET_FX
            Type type = typeof(T);
            System.Reflection.PropertyInfo[] properties = type.GetProperties();
            for (int cnti = 0; cnti < properties.Length; cnti++)
            {
                System.Reflection.PropertyInfo property = properties[cnti];
                if (!property.CanRead)
                {
                    continue;
                }
                // ICollection 구현체에 대한 재귀 오류 수정처리, 2016-05-19,, leeyonghun
                rtnValue.Add(property.Name, property.Name.Equals("SyncRoot") ? property.GetValue(source, null).ToString() : property.GetValue(source, null));
            }
#endif
            return(rtnValue);
        }
Пример #2
0
 /// <summary>모든 자료를 개별 AZData자료릐 배열로 변환하여 반환</summary>
 public AZData[] ToArray()
 {
     AZData[] rtnValue = new AZData[Size()];
     for (int cnti = 0; cnti < Size(); cnti++)
     {
         AZData dmyData = new AZData();
         dmyData.Add(GetKey(cnti), GetString(cnti));
         rtnValue[cnti] = dmyData;
     }
     return(rtnValue);
 }