MakeCamel() public static méthode

public static MakeCamel ( string identifier ) : string
identifier string
Résultat string
Exemple #1
0
 /// <summary>Ensures that the input is of the correct case by modifying the name according to the value of the <see cref="P:System.Xml.Serialization.CodeIdentifiers.UseCamelCasing" /> property. </summary>
 /// <returns>A string that is the same as the input identifier or has the first letter's case modified.</returns>
 /// <param name="identifier">The name to possibly modify.</param>
 public string MakeRightCase(string identifier)
 {
     if (this.UseCamelCasing)
     {
         return(CodeIdentifier.MakeCamel(identifier));
     }
     return(CodeIdentifier.MakePascal(identifier));
 }
 /// <include file='doc\CodeIdentifiers.uex' path='docs/doc[@for="CodeIdentifiers.MakeRightCase"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public string MakeRightCase(string identifier)
 {
     if (camelCase)
     {
         return(CodeIdentifier.MakeCamel(identifier));
     }
     else
     {
         return(CodeIdentifier.MakePascal(identifier));
     }
 }
Exemple #3
0
        CodeTypeMember CreateFieldMember(CodeTypeDeclaration codeClass, CodeTypeReference type, string name, object defaultValue, TypeData defaultType, string documentation)
        {
            CodeMemberField codeField = null;
            CodeTypeMember  codeProp  = null;

            if ((options & CodeGenerationOptions.GenerateProperties) > 0)
            {
                string field = identifiers.AddUnique(CodeIdentifier.MakeCamel(name + "Field"), name);
                codeField            = new CodeMemberField(type, field);
                codeField.Attributes = MemberAttributes.Private;
                codeClass.Members.Add(codeField);

                CodeMemberProperty prop = new CodeMemberProperty();
                prop.Name       = name;
                prop.Type       = type;
                prop.Attributes = MemberAttributes.Public | MemberAttributes.Final;
                codeProp        = prop;
                prop.HasGet     = prop.HasSet = true;

                CodeExpression ce = new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), field);
                prop.SetStatements.Add(new CodeAssignStatement(ce, new CodePropertySetValueReferenceExpression()));
                prop.GetStatements.Add(new CodeMethodReturnStatement(ce));
            }
            else
            {
                codeField            = new CodeMemberField(type, name);
                codeField.Attributes = MemberAttributes.Public;
                codeProp             = codeField;
            }

            if (defaultValue != System.DBNull.Value)
            {
                GenerateDefaultAttribute(codeField, codeProp, defaultType, defaultValue);
            }

            AddComments(codeProp, documentation);
            codeClass.Members.Add(codeProp);
            return(codeProp);
        }
 internal static string MakeFieldName(string name)
 {
     return(CodeIdentifier.MakeCamel(name) + "Field");
 }