Update all README examples to use KeywordOptionConfigurator API #6
+470
−81
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The new
KeywordOptionConfiguratorAPI provides a fluent syntax for specifying access modifiers. The README showed the legacy.WithKeyword("public")approach in several examples.Changes
Updated all code examples to use fluent keyword API wherever applicable:
ns.Public.Class()instead ofns.Class()+cls.WithKeyword("public")cls.Public.AutoProperty()instead ofp.WithKeyword("public")cls.Public.Method()instead ofmethod.WithKeyword("public")Updated sections:
ns.Public.Class()andcls.Public.AutoProperty()ns.Public.Class()andcls.Public.Method()classOption.WithKeyword("public")for TypeOption andclassOption.Public.AutoProperty()for propertiesclassOption.Public.Method()within a class contextclassOption.Public.Method()within a class contextAdded "Using Keyword Configurator" section demonstrating:
new NamespaceOption().WithName("X").Public.Class(...)Code.Create().Class(cls => cls.Public.AutoProperty(...))using Fengb3.EasyCodeBuilder.Csharp.OptionConfigurations;Updated Extension Methods documentation to include
Public,Private,Internal,Staticproperties andKeywordConfiguratorfor advanced chainingExample
Before:
After:
Testing
Comprehensive verification tests added for all 7 README examples to ensure they compile and produce expected output. All tests pass successfully.
Note: Some examples still use
.WithKeyword()where KeywordConfigurator support doesn't exist yet (e.g., Constructor doesn't have aPublic.Constructor()extension method).Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.