-
-
Notifications
You must be signed in to change notification settings - Fork 6
first #502
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
first #502
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| # Just later | ||
|
|
||
| ## Latest Update : 2026-05-13 => 13 May 2026 | ||
| ## Latest Update : 2026-05-14 => 14 May 2026 | ||
|
|
||
|
|
||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
|
|
||
| <h1>RSCG nr 269 : LinkDotNet.Enumeration</h1> | ||
|
|
||
| <h2>Info</h2> | ||
| Nuget : <a href="https://www.nuget.org/packages/LinkDotNet.Enumeration/" target="_blank">https://www.nuget.org/packages/LinkDotNet.Enumeration/</a> | ||
|
|
||
| <p>You can find more details at : <a href="https://github.com/linkdotnet/Enumeration" target="_blank"> https://github.com/linkdotnet/Enumeration</a></p> | ||
|
|
||
| <p>Author :Steven Giesel</p> | ||
|
|
||
| <p>Source: <a href="https://github.com/linkdotnet/Enumeration" target="_blank">https://github.com/linkdotnet/Enumeration</a> </p> | ||
|
|
||
| <h2>About</h2> | ||
|
|
||
| Generating enumeration from classes in C# with matching | ||
|
|
||
| <h2> | ||
| How to use | ||
| </h2> | ||
| <h3> | ||
| Add reference to the <a href="https://www.nuget.org/packages/LinkDotNet.Enumeration/" target="_blank">LinkDotNet.Enumeration</a> in the csproj | ||
| </h3> | ||
| <img src="images/LinkDotNet.Enumeration/EnumDemo.csproj.png" width="580" height="580" /> | ||
|
|
||
| <h3>This was for me the <b>starting</b> code</h3> | ||
|
|
||
| <br /> | ||
| I have <b>coded</b> the file Program.cs | ||
| <br /> | ||
| <img src="images/LinkDotNet.Enumeration/csFiles/Program.cs.png" width="580" height="580" /> | ||
| <hr /> | ||
|
|
||
| <br /> | ||
| I have <b>coded</b> the file CarTypes.cs | ||
| <br /> | ||
| <img src="images/LinkDotNet.Enumeration/csFiles/CarTypes.cs.png" width="580" height="580" /> | ||
| <hr /> | ||
| <h3>And here are the <i>generated</i> files</h3> | ||
|
|
||
| <br /> | ||
| The file <i>generated</i> is CarTypes.g.cs | ||
| <br /> | ||
| <img src="images/LinkDotNet.Enumeration/generated/CarTypes.g.cs.png" width="580" height="580" /> | ||
|
|
||
| <br /> | ||
| The file <i>generated</i> is EnumerationAttribute.g.cs | ||
| <br /> | ||
| <img src="images/LinkDotNet.Enumeration/generated/EnumerationAttribute.g.cs.png" width="580" height="580" /> | ||
|
|
||
| <p> | ||
| You can download the code and this page as pdf from | ||
| <a target="_blank" href='https://ignatandrei.github.io/RSCG_Examples/v2/docs/LinkDotNet.Enumeration'> | ||
| https://ignatandrei.github.io/RSCG_Examples/v2/docs/LinkDotNet.Enumeration | ||
| </a> | ||
| </p> | ||
|
|
||
|
|
||
| <p> | ||
| You can see the whole list at | ||
| <a target="_blank" href='https://ignatandrei.github.io/RSCG_Examples/v2/docs/List-of-RSCG'> | ||
| https://ignatandrei.github.io/RSCG_Examples/v2/docs/List-of-RSCG | ||
| </a> | ||
| </p> | ||
|
|
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -9,7 +9,50 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "source":"https://github.com/ItaiTzur76/GenerateDispose" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "data":{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "goodFor":["Generating the Dispose method for a class that implements IDisposable."], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "goodFor":["## Summary: GenerateDispose", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "### Purpose", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "A Roslyn source generator that replaces the 10+ lines of IDisposable boilerplate code with a single attribute.", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "It also automatically adapts the generated pattern when the class modifiers change (e.g. sealed to non-sealed).", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "### How to Define", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "[GenerateDispose.SourceGenerators.GenerateDispose(nameof(Drop))]", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "partial class DALDB : IDisposable // : IDisposable is optional!", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "{", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| " private ConnectionDB cn;", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| " private ConnectionDB cn1;", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| " public DALDB()", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| " {", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| " cn = new ConnectionDB();", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| " cn1 = new ConnectionDB();", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| " }", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| " public void Drop() // Your custom disposal logic", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| " {", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| " cn.Dispose();", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| " cn1.Dispose();", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| " }", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "}", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "- The class must be partial", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "- Pass nameof(YourDisposeMethod) to the attribute - the method must be callable with no arguments", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "### What Gets Generated", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "- public void Dispose() (thread-safe, calls your method)", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "- A private int _isDisposed field for double-dispose protection", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "- Adapts to sealed vs non-sealed automatically (private vs protected virtual)", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "### How to Use", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "using (var db = new DALDB())", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "{", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| " // use db...", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "} // Dispose() called automatically", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "### Key Benefits", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "- 10+ lines of boilerplate replaced by 1 attribute", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "- sealed changes auto-adapt the Dispose pattern", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "- No manual IDisposable wiring needed", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ""], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major | 🏗️ Heavy lift The The
Recommendation: Replace this with a brief 1-3 sentence summary. Move the detailed examples, code snippets, and multi-section tutorial content directly into the MDX documentation file where formatting can be controlled properly. ♻️ Proposed refactoring- "goodFor":["## Summary: GenerateDispose",
-"### Purpose",
-"A Roslyn source generator that replaces the 10+ lines of IDisposable boilerplate code with a single attribute.",
-"It also automatically adapts the generated pattern when the class modifiers change (e.g. sealed to non-sealed).",
-"",
-"### How to Define",
-"[GenerateDispose.SourceGenerators.GenerateDispose(nameof(Drop))]",
-"partial class DALDB : IDisposable // : IDisposable is optional!",
-"{",
-" private ConnectionDB cn;",
-" private ConnectionDB cn1;",
-"",
-" public DALDB()",
-" {",
-" cn = new ConnectionDB();",
-" cn1 = new ConnectionDB();",
-" }",
-"",
-" public void Drop() // Your custom disposal logic",
-" {",
-" cn.Dispose();",
-" cn1.Dispose();",
-" }",
-"}",
-"",
-"- The class must be partial",
-"- Pass nameof(YourDisposeMethod) to the attribute - the method must be callable with no arguments",
-"",
-"### What Gets Generated",
-"- public void Dispose() (thread-safe, calls your method)",
-"- A private int _isDisposed field for double-dispose protection",
-"- Adapts to sealed vs non-sealed automatically (private vs protected virtual)",
-"",
-"### How to Use",
-"using (var db = new DALDB())",
-"{",
-" // use db...",
-"} // Dispose() called automatically",
-"",
-"### Key Benefits",
-"- 10+ lines of boilerplate replaced by 1 attribute",
-"- sealed changes auto-adapt the Dispose pattern",
-"- No manual IDisposable wiring needed",
-""],
+ "goodFor":["Replaces 10+ lines of IDisposable boilerplate with a single attribute. Automatically adapts the Dispose pattern when class modifiers change (sealed/non-sealed)."],Then add the detailed tutorial content directly in the MDX file's "About" section with proper Markdown formatting. 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "csprojDemo":"IDisp.csproj", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "csFiles":["Program.cs","DALDB.cs","ConnectionDB.cs"], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "excludeDirectoryGenerated":[""], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| { | ||
| "generator":{ | ||
| "name":"LinkDotNet.Enumeration", | ||
| "nuget":[ | ||
| "https://www.nuget.org/packages/LinkDotNet.Enumeration/" | ||
| ], | ||
| "link":"https://github.com/linkdotnet/Enumeration", | ||
| "author":"Steven Giesel", | ||
| "source":"https://github.com/linkdotnet/Enumeration" | ||
| }, | ||
| "data":{ | ||
| "goodFor":["## Summary: LinkDotNet.Enumeration", | ||
| "", | ||
| "### Purpose", | ||
| "A source code generator that creates string-based enumerations (similar to Java enums / DDD value objects) with exhaustive pattern matching, replacing enum + switch patterns.", | ||
| "", | ||
| "### How to Define", | ||
| "[Enumeration(Casing.Preserve, \"None\", \"Dacia\", \"Tesla\", \"BMW\", \"Mercedes\")]", | ||
| "public sealed partial record CarTypes;", | ||
| "", | ||
| "### How to Use", | ||
| "CarTypes.TryParse(\"BMW\", null, out var car);", | ||
| "car.Match(onBMW: () => \"this is bmw\", onDacia: () => \"this is dacia\", ...);", | ||
| "", | ||
| "### Key Features", | ||
| "- Exhaustive matching: Match() requires all values", | ||
| "- Create / TryCreate: throws vs returns bool", | ||
| "- IParsable<T>: Minimal APIs & Model Binding", | ||
| "- Implicit string conversion", | ||
| "- CarTypes.All returns FrozenSet<CarTypes>", | ||
| "- JSON: GenerateJsonConverter = true" | ||
| ], | ||
| "csprojDemo":"EnumDemo.csproj", | ||
| "csFiles":["Program.cs","CarTypes.cs"], | ||
| "excludeDirectoryGenerated":[""], | ||
| "includeAdditionalFiles":[""] | ||
| }, | ||
| "links":{ | ||
| "blog":"", | ||
| "video":"" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Source code generated enumeration with completeness! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Escape the special character in HTML.
The
>character should be escaped as>in HTML content.🔧 Proposed fix
📝 Committable suggestion
🧰 Tools
🪛 HTMLHint (1.9.2)
[error] 20-20: Special characters must be escaped : [ > ].
(spec-char-escape)
🤖 Prompt for AI Agents