Ejemplo n.º 1
0
        // 將物件轉換成 Hash Entry Array
        public HashEntry[] TransToHashEntryArray(object hashObject)
        {
            PropertyInfo[] properties = hashObject.GetType().GetProperties();

            int count = 0;

            HashEntry[] hashEntryList = new HashEntry[properties.Length];

            foreach (PropertyInfo property in properties)
            {
                string value = "";

                if (property.GetValue(hashObject) != null)
                {
                    value = property.GetValue(hashObject).ToString();
                }

                hashEntryList.SetValue(new HashEntry(property.Name, value), count);

                count++;
            }

            return(hashEntryList);
        }