System.Xml.Serialization.CodeIdentifier.MakePascal C# (CSharp) Method

MakePascal() public static method

public static MakePascal ( string identifier ) : string
identifier string
return string
        public static string MakePascal(string identifier)
        {
            identifier = MakeValid(identifier);
            if (identifier.Length <= 2)
                return CultureInfo.InvariantCulture.TextInfo.ToUpper(identifier);
            else if (char.IsLower(identifier[0]))
                return char.ToUpperInvariant(identifier[0]) + identifier.Substring(1);
            else
                return identifier;
        }

Usage Example

Example #1
0
        private void SetArrayMappingType(ArrayMapping mapping)
        {
            string      typeName;
            string      str2;
            TypeMapping mapping2;
            bool        flag = false;

            if (mapping.Elements.Length == 1)
            {
                mapping2 = mapping.Elements[0].Mapping;
            }
            else
            {
                mapping2 = null;
            }
            if (mapping2 is EnumMapping)
            {
                str2     = mapping2.Namespace;
                typeName = mapping2.TypeName;
            }
            else if (mapping2 is PrimitiveMapping)
            {
                str2     = mapping2.TypeDesc.IsXsdType ? "http://www.w3.org/2001/XMLSchema" : "http://microsoft.com/wsdl/types/";
                typeName = mapping2.TypeDesc.DataType.Name;
                flag     = true;
            }
            else if (mapping2 is StructMapping)
            {
                if (mapping2.TypeDesc.IsRoot)
                {
                    str2     = "http://www.w3.org/2001/XMLSchema";
                    typeName = "anyType";
                    flag     = true;
                }
                else
                {
                    str2     = mapping2.Namespace;
                    typeName = mapping2.TypeName;
                }
            }
            else
            {
                if (!(mapping2 is ArrayMapping))
                {
                    throw new InvalidOperationException(Res.GetString("XmlInvalidSoapArray", new object[] { mapping.TypeDesc.FullName }));
                }
                str2     = mapping2.Namespace;
                typeName = mapping2.TypeName;
            }
            typeName = CodeIdentifier.MakePascal(typeName);
            string      str3     = "ArrayOf" + typeName;
            string      str4     = flag ? this.defaultNs : str2;
            int         num      = 1;
            TypeMapping mapping3 = (TypeMapping)this.types[str3, str4];

            while (mapping3 != null)
            {
                if (mapping3 is ArrayMapping)
                {
                    ArrayMapping mapping4 = (ArrayMapping)mapping3;
                    if (AccessorMapping.ElementsMatch(mapping4.Elements, mapping.Elements))
                    {
                        break;
                    }
                }
                str3     = typeName + num.ToString(CultureInfo.InvariantCulture);
                mapping3 = (TypeMapping)this.types[str3, str4];
                num++;
            }
            mapping.Namespace = str4;
            mapping.TypeName  = str3;
        }