diff --git a/README.md b/README.md index 7aaad1782..5f1d4a6b5 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ -# RSCG - 243 Examples of Roslyn Source Code Generators / 16 created by Microsoft / +# RSCG - 244 Examples of Roslyn Source Code Generators / 16 created by Microsoft / -The RSCG_Examples repository is a comprehensive documentation system that automatically processes and showcases 243 Roslyn Source Code Generator (RSCG) examples. The system transforms individual RSCG projects into structured documentation with code examples and cross-referenced content with a searchable website and code example exports. +The RSCG_Examples repository is a comprehensive documentation system that automatically processes and showcases 244 Roslyn Source Code Generator (RSCG) examples. The system transforms individual RSCG projects into structured documentation with code examples and cross-referenced content with a searchable website and code example exports. This system serves as both a learning resource for .NET developers interested in source generators and an automated pipeline for maintaining up-to-date documentation about the RSCG ecosystem -## Latest Update : 2025-11-15 => 15 November 2025 +## Latest Update : 2025-12-11 => 11 December 2025 If you want to see examples with code, please click ***[List V2](https://ignatandrei.github.io/RSCG_Examples/v2/docs/List-of-RSCG)*** @@ -12,7 +12,7 @@ If you want just those from Microsoft, please click ***[Microsoft](https://ignat If you want to see by category, please click ***[category](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples)*** or click any category below -[actor](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#actor) -[ai](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#ai) -[aop](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#aop) -[api](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#api) -[async](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#async) -[bitwise](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#bitwise) -[blazor](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#blazor) -[builder](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#builder) -[clone](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#clone) -[codetostring](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#codetostring) -[commandline](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#commandline) -[console](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#console) -[constructor](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#constructor) -[database](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#database) -[decorator](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#decorator) -[dependencyinjection](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#dependencyinjection) -[disposer](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#disposer) -[enhancementclass](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#enhancementclass) -[enhancementproject](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#enhancementproject) -[enum](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#enum) -[equals](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#equals) -[filestocode](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#filestocode) -[functionalprogramming](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#functionalprogramming) -[hangfire](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#hangfire) -[interface](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#interface) -[linq](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#linq) -[mapper](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#mapper) -[mcp](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#mcp) -[mediator](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#mediator) -[mixin](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#mixin) -[mvc](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#mvc) -[mvvm](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#mvvm) -[optimizer](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#optimizer) -[primitiveobsession](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#primitiveobsession) -[rx](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#rx) -[serializer](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#serializer) -[signalr](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#signalr) -[statemachine](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#statemachine) -[templating](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#templating) -[tests](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#tests) -[validator](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#validator) -[winapi](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#winapi) - +[actor](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#actor) -[ai](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#ai) -[aop](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#aop) -[api](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#api) -[async](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#async) -[bitwise](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#bitwise) -[blazor](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#blazor) -[bool](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#bool) -[builder](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#builder) -[clone](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#clone) -[codetostring](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#codetostring) -[commandline](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#commandline) -[console](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#console) -[constructor](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#constructor) -[database](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#database) -[decorator](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#decorator) -[dependencyinjection](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#dependencyinjection) -[disposer](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#disposer) -[enhancementclass](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#enhancementclass) -[enhancementproject](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#enhancementproject) -[enum](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#enum) -[equals](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#equals) -[filestocode](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#filestocode) -[functionalprogramming](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#functionalprogramming) -[hangfire](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#hangfire) -[interface](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#interface) -[linq](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#linq) -[mapper](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#mapper) -[mcp](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#mcp) -[mediator](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#mediator) -[mixin](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#mixin) -[mvc](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#mvc) -[mvvm](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#mvvm) -[optimizer](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#optimizer) -[primitiveobsession](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#primitiveobsession) -[rx](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#rx) -[serializer](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#serializer) -[signalr](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#signalr) -[statemachine](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#statemachine) -[templating](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#templating) -[tests](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#tests) -[validator](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#validator) -[winapi](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#winapi) - ## If you have a Roslyn Source Code Generator, please create an issue. @@ -24,8 +24,32 @@ If you want to be notified each time I add a new RSCG example , please click htt ## Content -Those are the 243 Roslyn Source Code Generators that I have tested you can see and download source code example. +Those are the 244 Roslyn Source Code Generators that I have tested you can see and download source code example. ( including 16 from Microsoft ) +### 244. [BoolParameterGenerator](https://ignatandrei.github.io/RSCG_Examples/v2/docs/BoolParameterGenerator) , in the [Bool](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#bool) category + +Generated on : 2025-12-11 => 11 December 2025 + +
+ Expand + + + +Author: Justin Buchanan + +BoolParameterGenerator is a Roslyn analyzer and source generator that automatically creates replacement types for boolean parameters in C# code. + This improves code readability and maintainability by replacing ambiguous bools with descriptive types. + See the README for usage and examples. + +Nuget: [https://www.nuget.org/packages/BoolParameterGenerator/](https://www.nuget.org/packages/BoolParameterGenerator/) + + +Link: [https://ignatandrei.github.io/RSCG_Examples/v2/docs/BoolParameterGenerator](https://ignatandrei.github.io/RSCG_Examples/v2/docs/BoolParameterGenerator) + +Source: [https://github.com/9swampy/BoolEnumGenerator](https://github.com/9swampy/BoolEnumGenerator) + +
+ ### 243. [RSCG_MCP2File](https://ignatandrei.github.io/RSCG_Examples/v2/docs/RSCG_MCP2File) , in the [MCP](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#mcp) category Generated on : 2025-11-15 => 15 November 2025 diff --git a/later.md b/later.md index ff94976d0..aa29dee05 100644 --- a/later.md +++ b/later.md @@ -1,6 +1,6 @@ # Just later -## Latest Update : 2025-11-15 => 15 November 2025 +## Latest Update : 2025-12-11 => 11 December 2025 diff --git a/v2/Generator/MultiGeneratorV2.cs b/v2/Generator/MultiGeneratorV2.cs index 213f1e9b2..078a5595e 100644 --- a/v2/Generator/MultiGeneratorV2.cs +++ b/v2/Generator/MultiGeneratorV2.cs @@ -118,6 +118,7 @@ public string[] SourceNoRSCG() if (File.Exists(nameFile)) { var text=await File.ReadAllTextAsync(nameFile); + text = text.Replace("(./BoolParameterGenerator.Github.Example/", $"({d.Generator!.Source}/BoolParameterGenerator.Github.Example/"); text = text.Replace("(docs/", $"({d.Generator!.Source}/docs/"); text = text.Replace("(img/", $"({d.Generator!.Source}/img/"); text = text.Replace("(./Images/", $"({d.Generator!.Source}/Images/"); diff --git a/v2/Generator/all.csv b/v2/Generator/all.csv index 29af49084..81e89f2a8 100644 --- a/v2/Generator/all.csv +++ b/v2/Generator/all.csv @@ -242,3 +242,4 @@ Nr,Key,Source,Category 241,RSCG_MCP2OpenAPI, https://github.com/ignatandrei/RSCG_OpenApi2MCP,MCP 242,DecoratorGenerator, https://github.com/CodingFlow/decorator-generator,Decorator 243,RSCG_MCP2File, https://github.com/ignatandrei/RSCG_OpenApi2MCP,MCP +244,BoolParameterGenerator, https://github.com/9swampy/BoolEnumGenerator,Bool diff --git a/v2/GeneratorData/Category.cs b/v2/GeneratorData/Category.cs index 951507d00..2df354dbc 100644 --- a/v2/GeneratorData/Category.cs +++ b/v2/GeneratorData/Category.cs @@ -44,6 +44,7 @@ public enum Category Mixin=39, Validator=40, Decorator= 41, - MCP= 42 + MCP= 42, + Bool=43 } diff --git a/v2/RSCGExamplesData/GeneratorDataRec.json b/v2/RSCGExamplesData/GeneratorDataRec.json index af9e8da14..0b56f65af 100644 --- a/v2/RSCGExamplesData/GeneratorDataRec.json +++ b/v2/RSCGExamplesData/GeneratorDataRec.json @@ -1472,5 +1472,11 @@ "Category": 42, "dtStart": "2025-11-15T00:00:00", "show": true +}, +{ + "ID":"BoolParameterGenerator", + "Category":43, + "dtStart": "2025-12-11T00:00:00", + "show": true } ] \ No newline at end of file diff --git a/v2/book/examples/BoolParameterGenerator.html b/v2/book/examples/BoolParameterGenerator.html new file mode 100644 index 000000000..b8f70772b --- /dev/null +++ b/v2/book/examples/BoolParameterGenerator.html @@ -0,0 +1,64 @@ + +

RSCG nr 244 : BoolParameterGenerator

+ +

Info

+Nuget : https://www.nuget.org/packages/BoolParameterGenerator/ + +

You can find more details at : https://github.com/9swampy/BoolEnumGenerator

+ +

Author :Justin Buchanan

+ +

Source: https://github.com/9swampy/BoolEnumGenerator

+ +

About

+ +Generate boolean enum types + +

+ How to use +

+

+ Add reference to the BoolParameterGenerator in the csproj +

+ + +

This was for me the starting code

+ +
+ I have coded the file Program.cs +
+ +
+ +
+ I have coded the file IsValid.cs +
+ +
+

And here are the generated files

+ +
+ The file generated is IsValid.g.cs +
+ + +
+ The file generated is GeneratorHeartbeat.g.cs +
+ + +

+ You can download the code and this page as pdf from + + https://ignatandrei.github.io/RSCG_Examples/v2/docs/BoolParameterGenerator + +

+ + +

+ You can see the whole list at + + https://ignatandrei.github.io/RSCG_Examples/v2/docs/List-of-RSCG + +

+ diff --git a/v2/book/list.html b/v2/book/list.html index 1b0c4ac07..cc6da149c 100644 --- a/v2/book/list.html +++ b/v2/book/list.html @@ -17,7 +17,7 @@

-This is the list of 243 RSCG with examples => +This is the list of 244 RSCG with examples =>

@@ -998,6 +998,10 @@

+ + + +
243 RSCG_MCP2File
244BoolParameterGenerator
diff --git a/v2/book/pandocHTML.yaml b/v2/book/pandocHTML.yaml index 0b512639c..02b7b9313 100644 --- a/v2/book/pandocHTML.yaml +++ b/v2/book/pandocHTML.yaml @@ -257,6 +257,7 @@ input-files: - examples/RSCG_MCP2OpenAPI.html - examples/DecoratorGenerator.html - examples/RSCG_MCP2File.html +- examples/BoolParameterGenerator.html # or you may use input-file: with a single value # defaults: diff --git a/v2/rscg_examples/BoolParameterGenerator/description.json b/v2/rscg_examples/BoolParameterGenerator/description.json new file mode 100644 index 000000000..e07e74d61 --- /dev/null +++ b/v2/rscg_examples/BoolParameterGenerator/description.json @@ -0,0 +1,22 @@ +{ + "generator":{ + "name":"BoolParameterGenerator", + "nuget":[ + "https://www.nuget.org/packages/BoolParameterGenerator/" + ], + "link":"https://github.com/9swampy/BoolEnumGenerator", + "author":"Justin Buchanan", + "source":"https://github.com/9swampy/BoolEnumGenerator" + }, + "data":{ + "goodFor":["Generate boolean enum types"], + "csprojDemo":"BoolDemo.csproj", + "csFiles":["Program.cs","IsValid.cs"], + "excludeDirectoryGenerated":[""], + "includeAdditionalFiles":[""] + }, + "links":{ + "blog":"", + "video":"" + } +} \ No newline at end of file diff --git a/v2/rscg_examples/BoolParameterGenerator/nuget.txt b/v2/rscg_examples/BoolParameterGenerator/nuget.txt new file mode 100644 index 000000000..8925cb894 --- /dev/null +++ b/v2/rscg_examples/BoolParameterGenerator/nuget.txt @@ -0,0 +1,3 @@ +BoolParameterGenerator is a Roslyn analyzer and source generator that automatically creates replacement types for boolean parameters in C# code. + This improves code readability and maintainability by replacing ambiguous bools with descriptive types. + See the README for usage and examples. \ No newline at end of file diff --git a/v2/rscg_examples/BoolParameterGenerator/readme.txt b/v2/rscg_examples/BoolParameterGenerator/readme.txt new file mode 100644 index 000000000..bc3018dfb --- /dev/null +++ b/v2/rscg_examples/BoolParameterGenerator/readme.txt @@ -0,0 +1,149 @@ +[![NuGet](https://img.shields.io/nuget/vpre/BoolParameterGenerator?label=NuGet)](https://www.nuget.org/packages/BoolParameterGenerator/) +[![Build Status](https://github.com/9swampy/BoolEnumGenerator/actions/workflows/nuget-publish.yml/badge.svg?branch=master)](https://github.com/9swampy/BoolEnumGenerator/actions/workflows/nuget-publish.yml) +# BoolParameterGenerator + +**BoolParameterGenerator** is a Roslyn analyzer and source generator that automatically creates replacement types for boolean parameters in C# code. This improves readability and maintainability by replacing ambiguous `bool` parameters with strongly typed, descriptive alternatives. + +## 🚫 Analyzer Rules Discouraging `bool` Parameters + +Using raw `bool` parameters in method signatures is often discouraged because it reduces code readability and clarity. Calls like `SetFeature(true)` can be ambiguous without context, making the code harder to understand and maintain. + +### Motivations for Avoiding `bool` Parameters + +- **Improved readability:** Boolean parameters often obscure the intent of the method call. +- **Explicit intent:** Descriptive enums or strong types clarify the purpose. +- **Better API discoverability:** Strongly typed parameters enhance IntelliSense and documentation. +- **Easier maintenance:** Clearer code reduces bugs and onboarding time. +- **Extensibility:** Enums or wrappers allow for additional states beyond simple true/false. + +### Popular Analyzers and Their Rules + +- **SonarAnalyzer (SonarLint / SonarQube)** + Rule: [S1133 - Remove boolean parameters](https://rules.sonarsource.com/csharp/RSPEC-1133) + Flags methods with boolean parameters to encourage more meaningful alternatives. + +- **Roslynator** + Rule: [RCS1155 - Avoid boolean parameters in methods](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1155.md) + Suggests replacing boolean parameters with separate methods or enums for better readability. + +- **StyleCop Analyzers** + While no specific rule bans boolean parameters, StyleCop encourages clear, descriptive API design that indirectly discourages ambiguous booleans. + +### How BoolParameterGenerator Addresses These Issues + +- Generates strongly typed, descriptive replacements for `bool` parameters. +- Improves code clarity, intent, and discoverability. +- Enables future extensibility beyond binary states. +- Helps maintain cleaner and more maintainable APIs. + +--- + +## ✨ Features + +- Replaces `bool` parameters with source-generated binary types. +- Supports generation of: + - Binary enums + - Struct-backed bool wrappers +- Seamless integration with IntelliSense and analyzers. +- Minimal configuration required. + +--- + +## πŸ“¦ Installation + +Install the main analyzer package via NuGet: + +```xml + +``` + +This will **transitively install** the required helper package `BoolParameterGenerator.Shared`. + +βœ… Works in: +- .NET SDK-style projects +- Class libraries +- Console apps +- Unit test projects + +--- + +## πŸš€ Usage + +Annotate a `partial class` with one of the supported generator attributes: + +```csharp +using PrimS.BoolParameterGenerator; + +[GenerateBinaryEnum("TrueValue", "FalseValue")] +public partial class MyBinaryEnum { } + +[GenerateBoolEnum("TrueValue", "FalseValue")] +public partial class MyBoolEnum { } +``` + +πŸ”§ Requirements: +- The class **must** be `partial`. +- The attribute arguments define the **true/false** semantics of the generated type. + +--- + +## πŸ“š Example Usage and Guidance + +For detailed examples illustrating the benefits of BoolParameterGenerator, see the following: + +- **Good Examples: Caller IntelliSense** β€” [CallerIntellisenseGoodExamples.cs](./BoolParameterGenerator.Github.Example/CallerIntellisenseGoodExamples.cs) +- **Good Examples: Implementation Patterns** β€” [ImplementationGoodExamples.cs](./BoolParameterGenerator.Github.Example/ImplementationGoodExamples.cs) +- **Bad Examples: Caller IntelliSense Pitfalls** β€” [CallerIntellisenseBadExamples.cs](./BoolParameterGenerator.Github.Example/CallerIntellisenseBadExamples.cs) +- **Bad Examples: Implementation Pitfalls** β€” [ImplementationBadExamples.cs](./BoolParameterGenerator.Github.Example/ImplementationBadExamples.cs) + +These demonstrate why replacing raw `bool` parameters with strongly typed proxies enhances readability, API clarity, and maintainability. + +## πŸ” Where to Find Generated Code + +1. Open your project in **Visual Studio**. +2. Navigate to `Dependencies > Analyzers > BoolParameterGenerator`. +3. Expand the node to find the generated `.g.cs` files (e.g., `MyBinaryEnum.g.cs`). + +⚠️ If only `Heartbeat.g.cs` appears: +- Ensure your partial class is declared correctly. +- Verify that attribute arguments are valid. +- Rebuild the project to trigger generation. + +--- + +## πŸ“¦ About the Shared Package + +Although the attributes (`GenerateBinaryEnum`, `GenerateBoolEnum`) are defined in a separate package `BoolParameterGenerator.Shared`, you do **not** need to reference it manually β€” it is installed transitively. + +There isn't much to choose one type attribute over the other atm. Under the hood the implementation is quite different and we expect the BinaryEnum could prove advantageous; especially with respect to extending to a tri-state "boolean". This is a Work-In-Progres and we would be very happy to receive feedback on useCases that may deviate in interesting ways from our own expectations... + +--- + +## πŸ§ͺ Confirmed Working Build/Contribution Setup + +Check out the latest master branch then validate everything is wired correctly: +1. Open only the generator projects (`BoolParameterGenerator` and `BoolParameterGenerator.Shared`) and the test project (`BoolParameterGenerator.Pack.Tests`). +2. Clean the solution. +3. Rebuild `BoolParameterGenerator.Pack.Tests`. +4. If BoolParameterGenerator analyzer references appear unresolved, try opening the file β€” often Visual Studio will resolve them automatically when the file is activated. +5. Rebuild again if necessary +1. You'll hopefully see `BEG004` diagnostics. + +--- + +## ⚠️ Namespace Caveat + +If the triggering class and the generated class are in **different namespaces**, generation may fail silently. Ensure the partial class declaration and the generated file reside in the same namespace, or adjust your generator logic to support custom namespaces. + +--- + +## πŸ“„ License + +MIT β€” essentially use however you like, just don't sue me if it doesn't work out! + +--- + +## 🧡 See Also + +- [BoolParameterGenerator GitHub Repo](https://github.com/9swampy/BoolEnumGenerator) +- [Source Generator Cookbook (Roslyn)](https://github.com/dotnet/roslyn/blob/main/docs/features/source-generators.cookbook.md) diff --git a/v2/rscg_examples/BoolParameterGenerator/src/.tours/BoolParameterGenerator.tour b/v2/rscg_examples/BoolParameterGenerator/src/.tours/BoolParameterGenerator.tour new file mode 100644 index 000000000..9d6d6c75e --- /dev/null +++ b/v2/rscg_examples/BoolParameterGenerator/src/.tours/BoolParameterGenerator.tour @@ -0,0 +1,42 @@ + +{ + "$schema": "https://aka.ms/codetour-schema", + "title": "BoolParameterGenerator", + "steps": + [ + { + "file": "BoolDemo/BoolDemo.csproj", + "description": "First, we add Nuget [BoolParameterGenerator](https://www.nuget.org/packages/BoolParameterGenerator/) in csproj ", + "pattern": "BoolParameterGenerator" + } + + ,{ + "file": "BoolDemo/IsValid.cs", + "description": "File IsValid.cs ", + "pattern": "this is the code" + } + + ,{ + "file": "BoolDemo/Program.cs", + "description": "File Program.cs \r\n>> dotnet run --project BoolDemo/BoolDemo.csproj ", + "pattern": "this is the code" + } + + + ,{ + "file": "BoolDemo/obj/GX/BoolParameterGenerator/PrimS.BoolParameterGenerator.BoolEnumGenerator/GeneratorHeartbeat.g.cs", + "description": "Generated File 2 from 2 : GeneratorHeartbeat.g.cs ", + "line": 1 + } + + ,{ + "file": "BoolDemo/obj/GX/BoolParameterGenerator/PrimS.BoolParameterGenerator.BinaryEnumGenerator/IsValid.g.cs", + "description": "Generated File 1 from 2 : IsValid.g.cs ", + "line": 1 + } + + ], + + "ref": "main" + +} \ No newline at end of file diff --git a/v2/rscg_examples/BoolParameterGenerator/src/BoolDemo.sln b/v2/rscg_examples/BoolParameterGenerator/src/BoolDemo.sln new file mode 100644 index 000000000..3534fe808 --- /dev/null +++ b/v2/rscg_examples/BoolParameterGenerator/src/BoolDemo.sln @@ -0,0 +1,25 @@ +ο»Ώ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.14.36414.22 d17.14 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BoolDemo", "BoolDemo\BoolDemo.csproj", "{E7C25C0F-DBEB-47CA-97B3-393A2B81A6E7}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E7C25C0F-DBEB-47CA-97B3-393A2B81A6E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E7C25C0F-DBEB-47CA-97B3-393A2B81A6E7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E7C25C0F-DBEB-47CA-97B3-393A2B81A6E7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E7C25C0F-DBEB-47CA-97B3-393A2B81A6E7}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {B3A7713E-DB4D-4C9A-8FC1-F5AC3258A69A} + EndGlobalSection +EndGlobal diff --git a/v2/rscg_examples/BoolParameterGenerator/src/BoolDemo/BoolDemo.csproj b/v2/rscg_examples/BoolParameterGenerator/src/BoolDemo/BoolDemo.csproj new file mode 100644 index 000000000..ec460049d --- /dev/null +++ b/v2/rscg_examples/BoolParameterGenerator/src/BoolDemo/BoolDemo.csproj @@ -0,0 +1,16 @@ +ο»Ώ + + + Exe + net9.0 + enable + enable + + + true + $(BaseIntermediateOutputPath)\GX + + + + + diff --git a/v2/rscg_examples/BoolParameterGenerator/src/BoolDemo/IsValid.cs b/v2/rscg_examples/BoolParameterGenerator/src/BoolDemo/IsValid.cs new file mode 100644 index 000000000..027497f07 --- /dev/null +++ b/v2/rscg_examples/BoolParameterGenerator/src/BoolDemo/IsValid.cs @@ -0,0 +1,9 @@ +ο»Ώ +using PrimS.BoolParameterGenerator; + +namespace BoolDemo; +[GenerateBinaryEnum("TrueValue", "FalseValue", GenerateAssertionExtensions =false)] +//[GenerateBoolEnum("TrueValue", "FalseValue", GenerateAssertionExtensions = false)] +public partial class IsValid +{ +} diff --git a/v2/rscg_examples/BoolParameterGenerator/src/BoolDemo/Program.cs b/v2/rscg_examples/BoolParameterGenerator/src/BoolDemo/Program.cs new file mode 100644 index 000000000..85dd75cbf --- /dev/null +++ b/v2/rscg_examples/BoolParameterGenerator/src/BoolDemo/Program.cs @@ -0,0 +1,3 @@ +ο»Ώusing BoolDemo; + +Console.WriteLine(IsValid.TrueValue); diff --git a/v2/rscg_examples/BoolParameterGenerator/video.json b/v2/rscg_examples/BoolParameterGenerator/video.json new file mode 100644 index 000000000..53277ade8 --- /dev/null +++ b/v2/rscg_examples/BoolParameterGenerator/video.json @@ -0,0 +1,39 @@ +{ + "scriptName": "BoolParameterGenerator", + "steps": +[ + {"typeStep":"exec","arg":"clipchamp.exe launch"}, + {"typeStep":"text","arg": "Welcome to Roslyn Examples"}, + {"typeStep":"text","arg":"If you want to see more examples , see List Of RSCG"}, + {"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/List-of-RSCG"}, + {"typeStep":"text","arg": "My name is Andrei Ignat and I am deeply fond of Roslyn Source Code Generator. "}, + +{"typeStep":"text","arg": "Today I will present BoolParameterGenerator . Generate boolean enum types ."}, +{"typeStep":"browser","arg":"https://www.nuget.org/packages/BoolParameterGenerator/"}, +{"typeStep":"text","arg": "The whole example is here"}, +{"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/BoolParameterGenerator"}, +{"typeStep":"text","arg": "You can download the code from here"}, +{"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/BoolParameterGenerator#download-example-net--c-"}, +{"typeStep":"text","arg":"Here is the code downloaded "}, +{"typeStep":"exec","arg":"explorer.exe /select,D:\\gth\\RSCG_Examples\\v2\\rscg_examples\\BoolParameterGenerator\\src\\BoolDemo.sln"}, +{"typeStep":"text","arg": "So , let's start the project with Visual Studio Code "}, +{"typeStep":"stepvscode","arg": "-n D:\\gth\\RSCG_Examples\\v2\\rscg_examples\\BoolParameterGenerator\\src"}, + +{"typeStep":"text","arg": "To use it ,you will put the Nuget BoolParameterGenerator into the csproj "}, + +{"typeStep":"stepvscode","arg": "-r -g D:\\gth\\RSCG_Examples\\v2\\rscg_examples\\BoolParameterGenerator\\src\\BoolDemo\\BoolDemo.csproj"}, + +{"typeStep":"text","arg": "And now I will show you an example of using BoolParameterGenerator"}, + +{"typeStep":"hide","arg": "now execute the tour in VSCode"}, +{"typeStep":"tour", "arg": "src/.tours/"}, +{"typeStep":"text","arg":" And I will execute the project"}, +{"typeStep":"showproj", "arg":"BoolDemo.csproj"}, +{"typeStep":"text","arg":" This concludes the project"}, +{"typeStep":"waitseconds","arg":"30"}, +{"typeStep":"text","arg": "Remember, you can download the code from here"}, +{"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/BoolParameterGenerator#download-example-net--c-", +SpeakTest=" "}, +{"typeStep":"waitseconds","arg":"30"}, +] +} diff --git a/v2/rscg_examples_site/docs/Authors/Justin_Buchanan.md b/v2/rscg_examples_site/docs/Authors/Justin_Buchanan.md new file mode 100644 index 000000000..0eb2a0170 --- /dev/null +++ b/v2/rscg_examples_site/docs/Authors/Justin_Buchanan.md @@ -0,0 +1,7 @@ +# Author : Justin Buchanan + +Number RSCG: 1 + + + 1 [BoolParameterGenerator](/docs/BoolParameterGenerator) [![Nuget](https://img.shields.io/nuget/dt/BoolParameterGenerator?label=BoolParameterGenerator)](https://www.nuget.org/packages/BoolParameterGenerator/) ![GitHub Repo stars](https://img.shields.io/github/stars/9swampy/BoolEnumGenerator?style=social) 2025-12-11 + diff --git a/v2/rscg_examples_site/docs/Categories/Bool.md b/v2/rscg_examples_site/docs/Categories/Bool.md new file mode 100644 index 000000000..338b37ddc --- /dev/null +++ b/v2/rscg_examples_site/docs/Categories/Bool.md @@ -0,0 +1,6 @@ +

Bool

+ +Number RSCG: 1 + + 1 [BoolParameterGenerator](/docs/BoolParameterGenerator) [![Nuget](https://img.shields.io/nuget/dt/BoolParameterGenerator?label=BoolParameterGenerator)](https://www.nuget.org/packages/BoolParameterGenerator/) ![GitHub Repo stars](https://img.shields.io/github/stars/9swampy/BoolEnumGenerator?style=social) 2025-12-11 + \ No newline at end of file diff --git a/v2/rscg_examples_site/docs/Categories/_PrimitiveBool.mdx b/v2/rscg_examples_site/docs/Categories/_PrimitiveBool.mdx new file mode 100644 index 000000000..6426c93d6 --- /dev/null +++ b/v2/rscg_examples_site/docs/Categories/_PrimitiveBool.mdx @@ -0,0 +1,7 @@ +### Category "Bool" has the following generators: + + 1 [BoolParameterGenerator](/docs/BoolParameterGenerator) [![Nuget](https://img.shields.io/nuget/dt/BoolParameterGenerator?label=BoolParameterGenerator)](https://www.nuget.org/packages/BoolParameterGenerator/) ![GitHub Repo stars](https://img.shields.io/github/stars/9swampy/BoolEnumGenerator?style=social) 2025-12-11 + +### See category + +[Bool](/docs/Categories/Bool) diff --git a/v2/rscg_examples_site/docs/RSCG-Examples/BoolParameterGenerator.md b/v2/rscg_examples_site/docs/RSCG-Examples/BoolParameterGenerator.md new file mode 100644 index 000000000..4b5adb3b7 --- /dev/null +++ b/v2/rscg_examples_site/docs/RSCG-Examples/BoolParameterGenerator.md @@ -0,0 +1,388 @@ +--- +sidebar_position: 2440 +title: 244 - BoolParameterGenerator +description: Generate boolean enum types +slug: /BoolParameterGenerator +--- +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; +import TOCInline from '@theme/TOCInline'; +import SameCategory from '../Categories/_PrimitiveBool.mdx'; + +# BoolParameterGenerator by Justin Buchanan + + + + +## NuGet / site data +[![Nuget](https://img.shields.io/nuget/dt/BoolParameterGenerator?label=BoolParameterGenerator)](https://www.nuget.org/packages/BoolParameterGenerator/) +[![GitHub last commit](https://img.shields.io/github/last-commit/9swampy/BoolEnumGenerator?label=updated)](https://github.com/9swampy/BoolEnumGenerator) +![GitHub Repo stars](https://img.shields.io/github/stars/9swampy/BoolEnumGenerator?style=social) + +## Details + +### Info +:::info + +Name: **BoolParameterGenerator** + +BoolParameterGenerator is a Roslyn analyzer and source generator that automatically creates replacement types for boolean parameters in C# code. + This improves code readability and maintainability by replacing ambiguous bools with descriptive types. + See the README for usage and examples. + +Author: Justin Buchanan + +NuGet: +*https://www.nuget.org/packages/BoolParameterGenerator/* + + +You can find more details at https://github.com/9swampy/BoolEnumGenerator + +Source: https://github.com/9swampy/BoolEnumGenerator + +::: + +### Author +:::note +Justin Buchanan +![Alt text](https://github.com/9swampy.png) +::: + +### Original Readme +:::note + +[![NuGet](https://img.shields.io/nuget/vpre/BoolParameterGenerator?label=NuGet)](https://www.nuget.org/packages/BoolParameterGenerator/) +[![Build Status](https://github.com/9swampy/BoolEnumGenerator/actions/workflows/nuget-publish.yml/badge.svg?branch=master)](https://github.com/9swampy/BoolEnumGenerator/actions/workflows/nuget-publish.yml) +# BoolParameterGenerator + +**BoolParameterGenerator** is a Roslyn analyzer and source generator that automatically creates replacement types for boolean parameters in C# code. This improves readability and maintainability by replacing ambiguous `bool` parameters with strongly typed, descriptive alternatives. + +## 🚫 Analyzer Rules Discouraging `bool` Parameters + +Using raw `bool` parameters in method signatures is often discouraged because it reduces code readability and clarity. Calls like `SetFeature(true)` can be ambiguous without context, making the code harder to understand and maintain. + +### Motivations for Avoiding `bool` Parameters + +- **Improved readability:** Boolean parameters often obscure the intent of the method call. +- **Explicit intent:** Descriptive enums or strong types clarify the purpose. +- **Better API discoverability:** Strongly typed parameters enhance IntelliSense and documentation. +- **Easier maintenance:** Clearer code reduces bugs and onboarding time. +- **Extensibility:** Enums or wrappers allow for additional states beyond simple true/false. + +### Popular Analyzers and Their Rules + +- **SonarAnalyzer (SonarLint / SonarQube)** + Rule: [S1133 - Remove boolean parameters](https://rules.sonarsource.com/csharp/RSPEC-1133) + Flags methods with boolean parameters to encourage more meaningful alternatives. + +- **Roslynator** + Rule: [RCS1155 - Avoid boolean parameters in methods](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1155.md) + Suggests replacing boolean parameters with separate methods or enums for better readability. + +- **StyleCop Analyzers** + While no specific rule bans boolean parameters, StyleCop encourages clear, descriptive API design that indirectly discourages ambiguous booleans. + +### How BoolParameterGenerator Addresses These Issues + +- Generates strongly typed, descriptive replacements for `bool` parameters. +- Improves code clarity, intent, and discoverability. +- Enables future extensibility beyond binary states. +- Helps maintain cleaner and more maintainable APIs. + +--- + +## ✨ Features + +- Replaces `bool` parameters with source-generated binary types. +- Supports generation of: + - Binary enums + - Struct-backed bool wrappers +- Seamless integration with IntelliSense and analyzers. +- Minimal configuration required. + +--- + +## πŸ“¦ Installation + +Install the main analyzer package via NuGet: + +```xml + +``` + +This will **transitively install** the required helper package `BoolParameterGenerator.Shared`. + +βœ… Works in: +- .NET SDK-style projects +- Class libraries +- Console apps +- Unit test projects + +--- + +## πŸš€ Usage + +Annotate a `partial class` with one of the supported generator attributes: + +```csharp +using PrimS.BoolParameterGenerator; + +[GenerateBinaryEnum("TrueValue", "FalseValue")] +public partial class MyBinaryEnum \{ } + +[GenerateBoolEnum("TrueValue", "FalseValue")] +public partial class MyBoolEnum \{ } +``` + +πŸ”§ Requirements: +- The class **must** be `partial`. +- The attribute arguments define the **true/false** semantics of the generated type. + +--- + +## πŸ“š Example Usage and Guidance + +For detailed examples illustrating the benefits of BoolParameterGenerator, see the following: + +- **Good Examples: Caller IntelliSense** β€” [CallerIntellisenseGoodExamples.cs](https://github.com/9swampy/BoolEnumGenerator/BoolParameterGenerator.Github.Example/CallerIntellisenseGoodExamples.cs) +- **Good Examples: Implementation Patterns** β€” [ImplementationGoodExamples.cs](https://github.com/9swampy/BoolEnumGenerator/BoolParameterGenerator.Github.Example/ImplementationGoodExamples.cs) +- **Bad Examples: Caller IntelliSense Pitfalls** β€” [CallerIntellisenseBadExamples.cs](https://github.com/9swampy/BoolEnumGenerator/BoolParameterGenerator.Github.Example/CallerIntellisenseBadExamples.cs) +- **Bad Examples: Implementation Pitfalls** β€” [ImplementationBadExamples.cs](https://github.com/9swampy/BoolEnumGenerator/BoolParameterGenerator.Github.Example/ImplementationBadExamples.cs) + +These demonstrate why replacing raw `bool` parameters with strongly typed proxies enhances readability, API clarity, and maintainability. + +## πŸ” Where to Find Generated Code + +1. Open your project in **Visual Studio**. +2. Navigate to `Dependencies > Analyzers > BoolParameterGenerator`. +3. Expand the node to find the generated `.g.cs` files (e.g., `MyBinaryEnum.g.cs`). + +⚠️ If only `Heartbeat.g.cs` appears: +- Ensure your partial class is declared correctly. +- Verify that attribute arguments are valid. +- Rebuild the project to trigger generation. + +--- + +## πŸ“¦ About the Shared Package + +Although the attributes (`GenerateBinaryEnum`, `GenerateBoolEnum`) are defined in a separate package `BoolParameterGenerator.Shared`, you do **not** need to reference it manually β€” it is installed transitively. + +There isn't much to choose one type attribute over the other atm. Under the hood the implementation is quite different and we expect the BinaryEnum could prove advantageous; especially with respect to extending to a tri-state "boolean". This is a Work-In-Progres and we would be very happy to receive feedback on useCases that may deviate in interesting ways from our own expectations... + +--- + +## πŸ§ͺ Confirmed Working Build/Contribution Setup + +Check out the latest master branch then validate everything is wired correctly: +1. Open only the generator projects (`BoolParameterGenerator` and `BoolParameterGenerator.Shared`) and the test project (`BoolParameterGenerator.Pack.Tests`). +2. Clean the solution. +3. Rebuild `BoolParameterGenerator.Pack.Tests`. +4. If BoolParameterGenerator analyzer references appear unresolved, try opening the file β€” often Visual Studio will resolve them automatically when the file is activated. +5. Rebuild again if necessary +1. You'll hopefully see `BEG004` diagnostics. + +--- + +## ⚠️ Namespace Caveat + +If the triggering class and the generated class are in **different namespaces**, generation may fail silently. Ensure the partial class declaration and the generated file reside in the same namespace, or adjust your generator logic to support custom namespaces. + +--- + +## πŸ“„ License + +MIT β€” essentially use however you like, just don't sue me if it doesn't work out! + +--- + +## 🧡 See Also + +- [BoolParameterGenerator GitHub Repo](https://github.com/9swampy/BoolEnumGenerator) +- [Source Generator Cookbook (Roslyn)](https://github.com/dotnet/roslyn/blob/main/docs/features/source-generators.cookbook.md) + + +::: + +### About +:::note + +Generate boolean enum types + + +::: + +## How to use + +### Example (source csproj, source files) + + + + + +This is the CSharp Project that references **BoolParameterGenerator** +```xml showLineNumbers {14} + + + + Exe + net9.0 + enable + enable + + + true + $(BaseIntermediateOutputPath)\GX + + + + + + +``` + + + + + + This is the use of **BoolParameterGenerator** in *Program.cs* + +```csharp showLineNumbers +using BoolDemo; + +Console.WriteLine(IsValid.TrueValue); + +``` + + + + + This is the use of **BoolParameterGenerator** in *IsValid.cs* + +```csharp showLineNumbers + +using PrimS.BoolParameterGenerator; + +namespace BoolDemo; +[GenerateBinaryEnum("TrueValue", "FalseValue", GenerateAssertionExtensions =false)] +//[GenerateBoolEnum("TrueValue", "FalseValue", GenerateAssertionExtensions = false)] +public partial class IsValid +{ +} + +``` + + + + +### Generated Files + +Those are taken from $(BaseIntermediateOutputPath)\GX + + + + +```csharp showLineNumbers +namespace BoolDemo; + +#nullable enable + +using System; +using PrimS.BoolParameterGenerator; + +public partial class IsValid : SmartEnumWrapper, IEquatable, IComparable, IEquatable>, IComparable> +{ + public static readonly IsValid FalseValue = new IsValid(nameof(FalseValue), BinaryEnum.False); + public static readonly IsValid TrueValue = new IsValid(nameof(TrueValue), BinaryEnum.True); + + public bool BoolValue => ProxyValue == BinaryEnum.True; + + public static IsValid FromValue(BinaryEnum value) => value switch + { + BinaryEnum.False => FalseValue, + BinaryEnum.True => TrueValue, + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unhandled value for IsValid") + }; + + public static IsValid FromValue(bool value) => value switch + { + false => FalseValue, + true => TrueValue + }; + + private IsValid(string name, BinaryEnum value) : base(name, value) + \{ } + + public static implicit operator bool(IsValid value) + { + return value.Value == BinaryEnum.True; + } + + public static implicit operator IsValid(bool value) => value ? TrueValue : FalseValue; + + public static bool operator ==(IsValid left, IsValid right) => left.Value.Value == right.Value.Value; + + public static bool operator ==(IsValid left, bool right) => left.Value == (right ? BinaryEnum.True : BinaryEnum.False); + + public static bool operator ==(IsValid left, int right) => (int)left.Value.Value == right; + + public static bool operator ==(bool left, IsValid right) => (left ? 1 : 0) == (int)right.Value.Value; + + public static bool operator !=(IsValid left, IsValid right) => left.Value.Value != right.Value.Value; + + public static bool operator !=(IsValid left, bool right) => (int)left.Value.Value != (right ? 1 : 0); + + public static bool operator !=(IsValid left, int right) => (int)left.Value.Value != right; + + public static bool operator !=(bool left, IsValid right) => (left ? 1 : 0) != (int)right.Value.Value; + + public static implicit operator IsValid(BinaryEnum value) => IsValid.FromValue(value); + + public override bool Equals(object obj) => obj is IsValid other && this == other; + + public override int GetHashCode() => Value.GetHashCode(); + + public bool Equals(BinaryEnum other) => Equals(FromValue(other)); + + public int CompareTo(BinaryEnum other) => CompareTo(FromValue(other)); + + public int CompareTo(BinaryEnumWrapper? other) => Value.CompareTo(other?.Value); + + public bool Equals(BinaryEnumWrapper? other) => Value.Equals(other?.Value); +} +``` + + + + +```csharp showLineNumbers +// BoolEnumGenerator Generator ran successfully but found no GenerateBoolEnumAttribute to process. +``` + + + + +## Useful + +### Download Example (.NET C#) + +:::tip + +[Download Example project BoolParameterGenerator ](/sources/BoolParameterGenerator.zip) + +::: + + +### Share BoolParameterGenerator + + + +https://ignatandrei.github.io/RSCG_Examples/v2/docs/BoolParameterGenerator + + + diff --git a/v2/rscg_examples_site/docs/RSCG-Examples/index.md b/v2/rscg_examples_site/docs/RSCG-Examples/index.md index 5f156c418..403a59d28 100644 --- a/v2/rscg_examples_site/docs/RSCG-Examples/index.md +++ b/v2/rscg_examples_site/docs/RSCG-Examples/index.md @@ -1,7 +1,7 @@ --- sidebar_position: 30 -title: 243 RSCG list by category -description: 243 RSCG list by category +title: 244 RSCG list by category +description: 244 RSCG list by category slug: /rscg-examples --- @@ -169,6 +169,18 @@ import DocCardList from '@theme/DocCardList'; +## Bool +
+ + Expand Bool =>examples:1 + + + +[BoolParameterGenerator](/docs/BoolParameterGenerator) + +
+ + ## Builder
@@ -1568,6 +1580,8 @@ flowchart LR; Blazor--> BadIdeas.Icons.FontAwesome((BadIdeas.Icons.FontAwesome)) + Bool--> BoolParameterGenerator((BoolParameterGenerator)) + Builder--> BuilderGenerator((BuilderGenerator)) Builder--> Architect.DomainModeling((Architect.DomainModeling)) diff --git a/v2/rscg_examples_site/docs/about.md b/v2/rscg_examples_site/docs/about.md index 4fb4d3c8f..2d2db608a 100644 --- a/v2/rscg_examples_site/docs/about.md +++ b/v2/rscg_examples_site/docs/about.md @@ -6,7 +6,7 @@ title: About ## Content You will find here code examples -of 243 Roslyn Source Code Generator (RSCG) +of 244 Roslyn Source Code Generator (RSCG) that can be useful for you. That means, you will write more elegant and concise code - even if the generators code is not always nice to look. ## Are those examples ready for production? diff --git a/v2/rscg_examples_site/docs/indexRSCG.md b/v2/rscg_examples_site/docs/indexRSCG.md index 2ed4dbf19..589ce234d 100644 --- a/v2/rscg_examples_site/docs/indexRSCG.md +++ b/v2/rscg_examples_site/docs/indexRSCG.md @@ -7,9 +7,9 @@ slug: /List-of-RSCG import useBaseUrl from '@docusaurus/useBaseUrl'; -## 243 RSCG with examples in descending chronological order +## 244 RSCG with examples in descending chronological order -This is the list of 243 ( 16 from Microsoft) RSCG with examples +This is the list of 244 ( 16 from Microsoft) RSCG with examples [See by category](/docs/rscg-examples) [See as json](/exports/RSCG.json) [See as Excel](/exports/RSCG.xlsx) @@ -20,6 +20,7 @@ This is the list of 243 ( 16 from Microsoft) RSCG with examples | No | Name | Date | Category | | --------- | ----- | ---- | -------- | +|244| [BoolParameterGenerator by Justin Buchanan ](/docs/BoolParameterGenerator)|2025-12-11 => 11 December 2025 | [Bool](/docs/Categories/Bool) | |243| [RSCG_MCP2File by Ignat Andrei ](/docs/RSCG_MCP2File)|2025-11-15 => 15 November 2025 | [MCP](/docs/Categories/MCP) | |242| [DecoratorGenerator by Leopoldo Fu ](/docs/DecoratorGenerator)|2025-11-13 => 13 November 2025 | [Decorator](/docs/Categories/Decorator) | |241| [RSCG_MCP2OpenAPI by Ignat Andrei ](/docs/RSCG_MCP2OpenAPI)|2025-11-11 => 11 November 2025 | [MCP](/docs/Categories/MCP) | diff --git a/v2/rscg_examples_site/src/components/HomepageFeatures/index.js b/v2/rscg_examples_site/src/components/HomepageFeatures/index.js index 3f8111cf3..398b4db80 100644 --- a/v2/rscg_examples_site/src/components/HomepageFeatures/index.js +++ b/v2/rscg_examples_site/src/components/HomepageFeatures/index.js @@ -4,7 +4,7 @@ import styles from './styles.module.css'; const FeatureList = [ { -title: '243 Examples (16 from MSFT)', +title: '244 Examples (16 from MSFT)', Svg: require('@site/static/img/undraw_docusaurus_mountain.svg').default, description: ( <> diff --git a/v2/rscg_examples_site/static/exports/RSCG.json b/v2/rscg_examples_site/static/exports/RSCG.json index 9618ddef6..865e6a996 100644 --- a/v2/rscg_examples_site/static/exports/RSCG.json +++ b/v2/rscg_examples_site/static/exports/RSCG.json @@ -1945,6 +1945,14 @@ "Source": "https://github.com/ignatandrei/RSCG_OpenApi2MCP", "Category": "MCP", "AddedOn": "2025-11-15T00:00:00" + }, + { + "Name": "BoolParameterGenerator", + "Link": "https://ignatandrei.github.io/RSCG_Examples/v2/docs/BoolParameterGenerator", + "NuGet": "https://www.nuget.org/packages/BoolParameterGenerator/", + "Source": "https://github.com/9swampy/BoolEnumGenerator", + "Category": "Bool", + "AddedOn": "2025-12-11T00:00:00" } ] } \ No newline at end of file diff --git a/v2/rscg_examples_site/static/exports/RSCG.xlsx b/v2/rscg_examples_site/static/exports/RSCG.xlsx index 860db58dd..0c9a59ae7 100644 Binary files a/v2/rscg_examples_site/static/exports/RSCG.xlsx and b/v2/rscg_examples_site/static/exports/RSCG.xlsx differ diff --git a/v2/rscg_examples_site/static/sources/BoolParameterGenerator.zip b/v2/rscg_examples_site/static/sources/BoolParameterGenerator.zip new file mode 100644 index 000000000..f3ef3c953 Binary files /dev/null and b/v2/rscg_examples_site/static/sources/BoolParameterGenerator.zip differ