public sealed class GeneratedParserAttribute : Attribute
Public NotInheritable Class GeneratedParserAttribute
Inherits Attribute
Dim instance As GeneratedParserAttribute
public ref class GeneratedParserAttribute sealed : public Attribute
When this attribute is applied to a class that defines command line arguments, source generation will be used to create a CommandLineParserT instance for those arguments, instead of the normal approach which uses run-time reflection.
To use the generated parser, source generation will add several static methods to the target class: the CreateParser(ParseOptions) method, and the Parse(ParseOptions) method and its overload. If you are targeting an older version of .Net than .Net 7.0, the same methods are added, but they will not implement the static interfaces.
Using these generated methods allows the use of trimming and native AOT for your application, as they avoid the regular constructors of the CommandLineParser and CommandLineParserT class, which are incompatible with these options.
When using source generation with subcommands, you should also use a class with the GeneratedCommandManagerAttribute attribute to access the commands.
GeneratedParserAttribute | Initializes a new instance of the GeneratedParserAttribute class |
GenerateParseMethods | Gets or sets a value that indicates whether to generate an implementation of the IParserTSelf interface for the arguments class. |
TypeId | When implemented in a derived class, gets a unique identifier for this Attribute. (Inherited from Attribute) |
Equals | Returns a value that indicates whether this instance is equal to a specified object. (Inherited from Attribute) |
GetHashCode | Returns the hash code for this instance. (Inherited from Attribute) |
GetType | Gets the Type of the current instance. (Inherited from Object) |
IsDefaultAttribute | When overridden in a derived class, indicates whether the value of this instance is the default value for the derived class. (Inherited from Attribute) |
Match | When overridden in a derived class, returns a value that indicates whether this instance equals a specified object. (Inherited from Attribute) |
ToString | Returns a string that represents the current object. (Inherited from Object) |