コード例 #1
0
        public List <string> GetPropertiesNameOfClass(ContactViewModel pObject)
        {
            List <string> propertyList = new List <string>();

            if (pObject != null)
            {
                foreach (var prop in pObject.GetType().GetProperties(BindingFlags.Public))
                {
                    propertyList.Add(prop.Name);
                }
            }
            return(propertyList);
        }
コード例 #2
0
        public List <string> GetPropertiesValueOfClass(ContactViewModel pObject)
        {
            List <string> propertyList = new List <string>();

            if (pObject != null)
            {
                foreach (var prop in pObject.GetType().GetProperties(BindingFlags.Public))
                {
                    var propValue = "";
                    if (prop.Name == "addedAt" || prop.Name == "lastmodifieddate")
                    {
                        propValue = String.Format("{0:MM/dd/yy}", prop.GetValue(pObject, null));
                    }
                    else
                    {
                        propValue = prop.GetValue(pObject, null).ToString();
                    }
                    propertyList.Add(propValue);
                }
            }
            return(propertyList);
        }