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

GetCSharpName() static private method

static private GetCSharpName ( string name ) : string
name string
return string
        internal static string GetCSharpName(string name)
        {
            return EscapeKeywords(name.Replace('+', '.'));
        }

Same methods

CodeIdentifier::GetCSharpName ( Type t, Type parameters, int index, StringBuilder sb ) : int
CodeIdentifier::GetCSharpName ( Type t ) : string

Usage Example

 private void GenerateGetSerializer(Hashtable serializers, XmlMapping[] xmlMappings)
 {
     this.writer.Write("public override ");
     this.writer.Write(typeof(XmlSerializer).FullName);
     this.writer.Write(" GetSerializer(");
     this.writer.Write(typeof(Type).FullName);
     this.writer.WriteLine(" type) {");
     this.writer.Indent++;
     for (int i = 0; i < xmlMappings.Length; i++)
     {
         if (xmlMappings[i] is XmlTypeMapping)
         {
             Type type = xmlMappings[i].Accessor.Mapping.TypeDesc.Type;
             if (((type != null) && (type.IsPublic || type.IsNestedPublic)) && ((!DynamicAssemblies.IsTypeDynamic(type) && !type.IsGenericType) && (!type.ContainsGenericParameters || !DynamicAssemblies.IsTypeDynamic(type.GetGenericArguments()))))
             {
                 this.writer.Write("if (type == typeof(");
                 this.writer.Write(CodeIdentifier.GetCSharpName(type));
                 this.writer.Write(")) return new ");
                 this.writer.Write((string)serializers[xmlMappings[i].Key]);
                 this.writer.WriteLine("();");
             }
         }
     }
     this.writer.WriteLine("return null;");
     this.writer.Indent--;
     this.writer.WriteLine("}");
 }
All Usage Examples Of System.Xml.Serialization.CodeIdentifier::GetCSharpName