Beispiel #1
0
        public static string CreateUid(DisplayListMember component)
        {
            if (null == component)
                return null;

            Type type = component.GetType();
            int count = 0; // default

            if (UidDict.ContainsKey(type))
            {
                count = UidDict[type];
            }

            count++;
            UidDict[type] = count;

            var name = type.Name;

            // If the class name ends with a digit (which some autogenerated
            // classes do), then append an underscore before appending
            // the counter.
            int charCode = name[name.Length - 1];
            if (charCode >= 48 && charCode <= 57)
                name += "_";

            return string.Format("{0}{1}", name, count);
        }