Exemple #1
0
        /// <summary>
        /// Create a field of Name with type
        /// </summary>
        /// <param name="fieldName">name of the field</param>
        /// <param name="fieldType">Type of the field</param>
        internal FieldBuilder(string fieldName, Type fieldType)
        {
            fieldName = fieldName.Trim();

            if (ValidIdentifierValidator.ValidIdentifier(fieldName) == false)
            {
                throw new FileHelpersException($"The string '{fieldName}' not is a valid .NET identifier");
            }

            mFieldName = fieldName;
            mFieldType = ClassBuilder.TypeToString(fieldType);
        }
Exemple #2
0
        /// <summary>
        /// Create a class with 'classname'
        /// </summary>
        /// <param name="className">Name of class to create</param>
        internal ClassBuilder(string className)
        {
            className = className.Trim();
            if (ValidIdentifierValidator.ValidIdentifier(className) == false)
            {
                throw new FileHelpersException(Messages.Errors.InvalidIdentifier
                                               .Identifier(className)
                                               .Text);
            }

            mClassName = className;
        }
Exemple #3
0
        /// <summary>
        /// Create a field of Name with type
        /// </summary>
        /// <param name="fieldName">name of the field</param>
        /// <param name="fieldType">Type of the field</param>
        internal FieldBuilder(string fieldName, Type fieldType)
        {
            fieldName = fieldName.Trim();

            if (ValidIdentifierValidator.ValidIdentifier(fieldName) == false)
            {
                throw new FileHelpersException(Messages.Errors.InvalidIdentifier
                                               .Identifier(fieldName)
                                               .Text);
            }

            mFieldName = fieldName;
            mFieldType = ClassBuilder.TypeToString(fieldType);
        }