示例#1
0
        /// <summary>
        /// Generates code for the specified field information.
        /// </summary>
        /// <param name="fieldInfo">The field information.</param>
        /// <param name="options">The generator options.</param>
        /// <returns>System.String.</returns>
        public string Generate(FieldInfo fieldInfo, FieldGeneratorOptions options)
        {
            var sb = new StringBuilder();

            if (options.Access)
            {
                sb.Append(Generator.Access((MethodAttributes)fieldInfo.Attributes));
            }
            if (options.Modifiers)
            {
                sb.Append(Generator.Modifier(fieldInfo.Attributes));
            }
            if (options.Type)
            {
                sb.Append(Generator.Generate(fieldInfo.FieldType) + " ");
            }
            if (options.Name)
            {
                sb.Append(fieldInfo.Name);
            }
            //TODO Value;

            return(sb.ToString());
        }
示例#2
0
 /// <summary>
 /// Generates code for the specified field information.
 /// </summary>
 /// <param name="fieldInfo">The field information.</param>
 /// <returns>System.String.</returns>
 public string Generate(FieldInfo fieldInfo) => Generate(fieldInfo, FieldGeneratorOptions.Create(GeneratorMode));