예제 #1
0
        private string getInstitutionAlias(Institution institution)
        {
            try
            {
                Type t = institution.GetType();
                Debug.WriteLine("TYPE: " + t.Name);
                Debug.WriteLine("props Count: " + t.GetMembers().Length);
                MemberInfo[] memberInfos = t.GetMember(institution.ToString());
                MemberInfo   memberInfo  = memberInfos.FirstOrDefault(m => m.DeclaringType.Name == typeof(Institution).Name);
                Debug.WriteLine("prop: " + memberInfo.Name);
                InstitutionInfo info = (InstitutionInfo)memberInfo.GetCustomAttribute(typeof(InstitutionInfo));

                return(info.Alias);
            }
            catch (Exception e)
            {
                Debug.WriteLine("Error getting institution alias: " + e.Message);
                return(institution.ToString());
            }
        }