public static string GetName(Type objType, ChoDefaultObjectKey typeName)
        {
            ChoGuard.ArgumentNotNull(objType, "Type");
            ChoObjectNameableAttribute objectNameableAttribute = ChoType.GetAttribute(objType, typeof(ChoObjectNameableAttribute)) as ChoObjectNameableAttribute;

            string key = null;

            if (objectNameableAttribute != null)
            {
                key = objectNameableAttribute.Name;
            }
            else
            {
                switch (typeName)
                {
                case ChoDefaultObjectKey.FullName:
                    key = objType.FullName;
                    break;

                case ChoDefaultObjectKey.AssemblyQualifiedName:
                    key = objType.AssemblyQualifiedName;
                    break;

                default:
                    key = objType.Name;
                    break;
                }
            }

            return(key);
        }
예제 #2
0
        public static string GetName(Type objType, ChoTypeNameSpecifier typeNameSpecifier)
        {
            ChoGuard.ArgumentNotNull(objType, "Type");
            ChoObjectNameableAttribute objectNameableAttribute = ChoType.GetAttribute(objType, typeof(ChoObjectNameableAttribute)) as ChoObjectNameableAttribute;

            string key = null;

            if (objectNameableAttribute != null)
            {
                key = objectNameableAttribute.Name;
            }
            else
            {
                key = objType.GetName(typeNameSpecifier);
            }

            return(key);
        }