diff --git a/README.md b/README.md
index 4628d325e..a01de36d7 100644
--- a/README.md
+++ b/README.md
@@ -1,10 +1,10 @@
-# RSCG - 273 Examples of Roslyn Source Code Generators / 16 created by Microsoft /
+# RSCG - 274 Examples of Roslyn Source Code Generators / 16 created by Microsoft /
-The RSCG_Examples repository is a comprehensive documentation system that automatically processes and showcases 273 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 274 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 : 2026-06-30 => 30 June 2026
+## Latest Update : 2026-07-01 => 01 July 2026
If you want to see examples with code, please click ***[List V2](https://ignatandrei.github.io/RSCG_Examples/v2/docs/List-of-RSCG)***
@@ -24,8 +24,30 @@ If you want to be notified each time I add a new RSCG example , please click htt
## Content
-Those are the 273 Roslyn Source Code Generators that I have tested you can see and download source code example.
+Those are the 274 Roslyn Source Code Generators that I have tested you can see and download source code example.
( including 16 from Microsoft )
+### 274. [Dirge](https://ignatandrei.github.io/RSCG_Examples/v2/docs/Dirge) , in the [Disposer](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#disposer) category
+
+Generated on : 2026-07-01 => 01 July 2026
+
+
+ Expand
+
+
+
+Author: Kazuki Kohzuki
+
+Disposable Implementation Roslyn Generator Extension
+
+Nuget: [https://www.nuget.org/packages/Dirge/](https://www.nuget.org/packages/Dirge/)
+
+
+Link: [https://ignatandrei.github.io/RSCG_Examples/v2/docs/Dirge](https://ignatandrei.github.io/RSCG_Examples/v2/docs/Dirge)
+
+Source: [https://github.com/IkuzakIkuzok/Dirge](https://github.com/IkuzakIkuzok/Dirge)
+
+
+
### 273. [ScottEncodingGenerator](https://ignatandrei.github.io/RSCG_Examples/v2/docs/ScottEncodingGenerator) , in the [FunctionalProgramming](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#functionalprogramming) category
Generated on : 2026-06-30 => 30 June 2026
diff --git a/later.md b/later.md
index 6609fbb71..8c0ad9ff3 100644
--- a/later.md
+++ b/later.md
@@ -1,6 +1,6 @@
# Just later
-## Latest Update : 2026-06-30 => 30 June 2026
+## Latest Update : 2026-07-01 => 01 July 2026
diff --git a/v2/Generator/all.csv b/v2/Generator/all.csv
index 5fab7fc6f..a7e6336bb 100644
--- a/v2/Generator/all.csv
+++ b/v2/Generator/all.csv
@@ -272,3 +272,4 @@ Nr,Key,Source,Category
271,TypedStateBuilder.Generator, https://github.com/Georgiy-Petrov/TypedStateBuilder.Generator,Builder
272,AlephMapper, https://github.com/Raffinert/AlephMapper,Database
273,ScottEncodingGenerator, https://github.com/Georgiy-Petrov/ScottEncodingGenerator,FunctionalProgramming
+274,Dirge, https://github.com/IkuzakIkuzok/Dirge,Disposer
diff --git a/v2/RSCGExamplesData/GeneratorDataRec.json b/v2/RSCGExamplesData/GeneratorDataRec.json
index 0c101513a..dac3dcc7f 100644
--- a/v2/RSCGExamplesData/GeneratorDataRec.json
+++ b/v2/RSCGExamplesData/GeneratorDataRec.json
@@ -1654,5 +1654,11 @@
"Category": 10,
"dtStart": "2026-06-30T00:00:00",
"show": true
+ },
+ {
+ "ID": "Dirge",
+ "Category": 18,
+ "dtStart": "2026-07-01T00:00:00",
+ "show": true
}
]
\ No newline at end of file
diff --git a/v2/book/examples/Dirge.html b/v2/book/examples/Dirge.html
new file mode 100644
index 000000000..ba480b25a
--- /dev/null
+++ b/v2/book/examples/Dirge.html
@@ -0,0 +1,80 @@
+
+
RSCG nr 274 : Dirge
+
+Info
+Nuget : https://www.nuget.org/packages/Dirge/
+
+You can find more details at : https://github.com/IkuzakIkuzok/Dirge
+
+Author :Kazuki Kohzuki
+
+Source: https://github.com/IkuzakIkuzok/Dirge
+
+About
+
+**Dirge** is a Roslyn-based code generator that automatically implements the `IDisposable` pattern for C# classes.Key Features:1. **AutoDispose Attribute**: Mark any partial class with `[AutoDispose]` to automatically generate `Dispose()` and `Dispose(bool)` methods.2. **Automatic Field Disposal**: The generator detects all disposable fields and automatically calls `.Dispose()` on them in the correct order.
+
+
+ How to use
+
+
+ Add reference to the Dirge in the csproj
+
+
+
+This was for me the starting code
+
+
+ I have coded the file Program.cs
+
+
+
+
+
+ I have coded the file DALDB.cs
+
+
+
+
+
+ I have coded the file ConnectionDB.cs
+
+
+
+ And here are the generated files
+
+
+ The file generated is DALDB.GeneratedDispose.g.cs
+
+
+
+
+ The file generated is AutoDisposeAttribute.g.cs
+
+
+
+
+ The file generated is DoNotDisposeAttribute.g.cs
+
+
+
+
+ The file generated is DoNotDisposeWhenAttribute.g.cs
+
+
+
+
+ You can download the code and this page as pdf from
+
+ https://ignatandrei.github.io/RSCG_Examples/v2/docs/Dirge
+
+
+
+
+
+ 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 35f18431c..8e3fe29b8 100644
--- a/v2/book/list.html
+++ b/v2/book/list.html
@@ -17,7 +17,7 @@
-This is the list of 273 RSCG with examples =>
+This is the list of 274 RSCG with examples =>
diff --git a/v2/book/pandocHTML.yaml b/v2/book/pandocHTML.yaml
index bcabfbc43..d893be639 100644
--- a/v2/book/pandocHTML.yaml
+++ b/v2/book/pandocHTML.yaml
@@ -287,6 +287,7 @@ input-files:
- examples/TypedStateBuilder.Generator.html
- examples/AlephMapper.html
- examples/ScottEncodingGenerator.html
+- examples/Dirge.html
# or you may use input-file: with a single value
# defaults:
diff --git a/v2/docFind.json b/v2/docFind.json
index b8e962f3d..c8c648642 100644
--- a/v2/docFind.json
+++ b/v2/docFind.json
@@ -1636,5 +1636,11 @@
"category": "FunctionalProgramming",
"href": "/RSCG_Examples/v2/docs/ScottEncodingGenerator/",
"body": "Roslyn incremental source generator for partial interfaces and abstract partial classes that generates Match methods, nested case implementations, and companion module helpers for Scott-encoded types."
+ },
+ {
+ "title": "Dirge",
+ "category": "Disposer",
+ "href": "/RSCG_Examples/v2/docs/Dirge/",
+ "body": "Disposable Implementation Roslyn Generator Extension"
}
]
\ No newline at end of file
diff --git a/v2/rscg_examples/Dirge/description.json b/v2/rscg_examples/Dirge/description.json
new file mode 100644
index 000000000..39601777a
--- /dev/null
+++ b/v2/rscg_examples/Dirge/description.json
@@ -0,0 +1,32 @@
+{
+ "generator":{
+ "name":"Dirge",
+ "nuget":[
+ "https://www.nuget.org/packages/Dirge/"
+ ],
+ "link":"https://github.com/IkuzakIkuzok/Dirge",
+ "author":"Kazuki Kohzuki",
+ "source":"https://github.com/IkuzakIkuzok/Dirge"
+ },
+ "data":{
+ "goodFor":["",
+"",
+"Dirge is a Roslyn-based code generator that automatically implements the `IDisposable` pattern for C# classes.",
+"",
+"Key Features:",
+"",
+"1. AutoDispose Attribute: Mark any partial class with `[AutoDispose]` to automatically generate `Dispose()` and `Dispose(bool)` methods.",
+"",
+"2. Automatic Field Disposal: The generator detects all disposable fields and automatically calls `.Dispose()` on them in the correct order.",
+""
+],
+ "csprojDemo":"IDisp.csproj",
+ "csFiles":["Program.cs","DALDB.cs","ConnectionDB.cs"],
+ "excludeDirectoryGenerated":[""],
+ "includeAdditionalFiles":[""]
+ },
+ "links":{
+ "blog":"",
+ "video":""
+ }
+}
\ No newline at end of file
diff --git a/v2/rscg_examples/Dirge/nuget.txt b/v2/rscg_examples/Dirge/nuget.txt
new file mode 100644
index 000000000..4b2717b09
--- /dev/null
+++ b/v2/rscg_examples/Dirge/nuget.txt
@@ -0,0 +1 @@
+Disposable Implementation Roslyn Generator Extension
\ No newline at end of file
diff --git a/v2/rscg_examples/Dirge/readme.txt b/v2/rscg_examples/Dirge/readme.txt
new file mode 100644
index 000000000..7c7315870
--- /dev/null
+++ b/v2/rscg_examples/Dirge/readme.txt
@@ -0,0 +1,215 @@
+
+# Dirge
+
+[](https://github.com/IkuzakIkuzok/Dirge/actions/workflows/Test.yml)
+[](https://www.nuget.org/packages/Dirge/#versions-body-tab)
+[](https://www.nuget.org/packages/Dirge/#versions-body-tab)
+[](https://github.com/IkuzakIkuzok/Dirge/blob/main/LICENSE)
+
+Disposable Implementation Roslyn Generator Extension
+## Installation
+
+You can install the EnumSerializer from [NuGet](https://www.nuget.org/packages/Dirge/).
+
+## Usage
+
+Mark a class with the `[AutoDispose]` attribute and implement the `IDisposable` interface.
+The generator will automatically generate the implementation of the `Dispose` method for you.
+
+```C#
+using Dirge;
+
+namespace Test;
+
+[AutoDispose]
+internal partial class TestClass
+{
+ private readonly Stream _stream = new MemoryStream();
+}
+```
+
+The generated code will look like this:
+```C#
+namespace Test;
+
+partial class TestClass : IDisposable
+{
+ private bool __generated_disposed = false;
+
+ public void Dispose()
+ {
+ Dispose(true);
+ global::System.GC.SuppressFinalize(this);
+ }
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (this.__generated_disposed) return;
+
+ try
+ {
+ if (disposing)
+ {
+ this._stream?.Dispose();
+ }
+ }
+ finally
+ {
+ this.__generated_disposed = true;
+ }
+ }
+}
+```
+
+Note that this example is simplified for demonstration purposes.
+
+To suppress the auto-generated Dispose call for a specific field, you can use the `[DoNotDispose]` attribute:
+```C#
+using Dirge;
+
+namespace Test;
+
+[AutoDispose]
+internal partial class TestClass
+{
+ private readonly Stream _stream1 = new MemoryStream();
+
+ [DoNotDispose]
+ private readonly Stream _stream2 = new MemoryStream(); // This field will not be disposed by the generated Dispose method.
+}
+```
+
+Ref-struct is also supported, but `IDisposable` will not be implemented regardless of the language version.
+
+### Conditional disposal
+
+Conditional disposal, which allows you to specify conditions under which a field should be disposed, is also supported.
+You can use the `[DoNotDisposeWhen]` attribute with a boolean field and a value to compare against:
+```C#
+using Dirge;
+
+namespace Test;
+
+[AutoDispose]
+internal partial class TestClass
+{
+ private readonly bool _leaveOpen;
+
+ [DoNotDisposeWhen(nameof(_leaveOpen), true)]
+ private readonly Stream _stream;
+
+ internal TestClass(Stream stream, bool leaveOpen)
+ {
+ this._stream = stream;
+ this._leaveOpen = leaveOpen;
+ }
+}
+```
+
+This will prevent the generator from disposing the `_stream` field when the `_leaveOpen` field is `true`:
+```C#
+namespace Test;
+
+partial class TestClass : IDisposable
+{
+ private bool __generated_disposed = false;
+
+ public void Dispose()
+ {
+ Dispose(true);
+ global::System.GC.SuppressFinalize(this);
+ }
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (this.__generated_disposed) return;
+
+ try
+ {
+ if (disposing)
+ {
+ if (!this._leaveOpen)
+ {
+ this._stream?.Dispose();
+ }
+ }
+ }
+ finally
+ {
+ this.__generated_disposed = true;
+ }
+ }
+}
+```
+
+### Unmanaged resources
+
+To safely release unmanaged resources, this generator also supports the implementation of a finalizer.
+You can specify a method to release unmanaged resources through the `ReleaseUnmanagedResources` option:
+```C#
+using Dirge;
+using System.IO;
+
+namespace Test;
+
+[AutoDispose(ReleaseUnmanagedResources = nameof(ReleaseUnmanagedResources))]
+internal sealed partial class TestClass
+{
+ private readonly Stream _stream;
+
+ internal void ReleaseUnmanagedResources()
+ {
+ // Custom logic to release unmanaged resources
+ }
+}
+```
+
+This will generate a finalizer that calls the specified method to release unmanaged resources:
+```C#
+namespace Test;
+
+sealed partial class TestClass : IDisposable
+{
+ private bool __generated_disposed = false;
+
+ public void Dispose()
+ {
+ Dispose(true);
+ global::System.GC.SuppressFinalize(this);
+ }
+
+ private void Dispose(bool disposing)
+ {
+ if (this.__generated_disposed) return;
+
+ try
+ {
+ if (disposing)
+ {
+ this._stream?.Dispose();
+ }
+
+ ReleaseUnmanagedResources();
+ }
+ finally
+ {
+ this.__generated_disposed = true;
+ }
+ }
+
+ ~TestClass()
+ {
+ Dispose(false);
+ }
+}
+```
+
+## Constraints
+
+To generate the `Dispose` method, the class (or struct) must meet the following constraints:
+- It must be a non-static class.
+- It must be a partial class or struct.
+- It must not be a readonly struct.
+
+For conditional disposal, the field specified in the `nameof` expression must be a boolean field.
+Properties and methods are not supported for the current version.
diff --git a/v2/rscg_examples/Dirge/src/.tours/Dirge.tour b/v2/rscg_examples/Dirge/src/.tours/Dirge.tour
new file mode 100644
index 000000000..29b4d9e77
--- /dev/null
+++ b/v2/rscg_examples/Dirge/src/.tours/Dirge.tour
@@ -0,0 +1,60 @@
+
+{
+ "$schema": "https://aka.ms/codetour-schema",
+ "title": "Dirge",
+ "steps":
+ [
+ {
+ "file": "IDisp/IDisp.csproj",
+ "description": "First, we add Nuget [Dirge](https://www.nuget.org/packages/Dirge/) in csproj ",
+ "pattern": "Dirge"
+ }
+
+ ,{
+ "file": "IDisp/ConnectionDB.cs",
+ "description": "File ConnectionDB.cs ",
+ "pattern": "this is the code"
+ }
+
+ ,{
+ "file": "IDisp/DALDB.cs",
+ "description": "File DALDB.cs ",
+ "pattern": "this is the code"
+ }
+
+ ,{
+ "file": "IDisp/Program.cs",
+ "description": "File Program.cs \r\n>> dotnet run --project IDisp/IDisp.csproj ",
+ "pattern": "this is the code"
+ }
+
+
+ ,{
+ "file": "IDisp/obj/GX/Dirge/Dirge.Generators.TypesGenerator/DoNotDisposeWhenAttribute.g.cs",
+ "description": "Generated File 4 from 4 : DoNotDisposeWhenAttribute.g.cs ",
+ "line": 1
+ }
+
+ ,{
+ "file": "IDisp/obj/GX/Dirge/Dirge.Generators.TypesGenerator/DoNotDisposeAttribute.g.cs",
+ "description": "Generated File 3 from 4 : DoNotDisposeAttribute.g.cs ",
+ "line": 1
+ }
+
+ ,{
+ "file": "IDisp/obj/GX/Dirge/Dirge.Generators.TypesGenerator/AutoDisposeAttribute.g.cs",
+ "description": "Generated File 2 from 4 : AutoDisposeAttribute.g.cs ",
+ "line": 1
+ }
+
+ ,{
+ "file": "IDisp/obj/GX/Dirge/Dirge.Generators.DisposeGenerator/DALDB.GeneratedDispose.g.cs",
+ "description": "Generated File 1 from 4 : DALDB.GeneratedDispose.g.cs ",
+ "line": 1
+ }
+
+ ],
+
+ "ref": "main"
+
+}
\ No newline at end of file
diff --git a/v2/rscg_examples/Dirge/src/IDisp.sln b/v2/rscg_examples/Dirge/src/IDisp.sln
new file mode 100644
index 000000000..ad2677ba6
--- /dev/null
+++ b/v2/rscg_examples/Dirge/src/IDisp.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.6.33829.357
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IDisp", "IDisp\IDisp.csproj", "{6237DD9A-6211-4046-97B4-754E12478992}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {6237DD9A-6211-4046-97B4-754E12478992}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {6237DD9A-6211-4046-97B4-754E12478992}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {6237DD9A-6211-4046-97B4-754E12478992}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {6237DD9A-6211-4046-97B4-754E12478992}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {81F892FB-0998-4DEA-92E1-55B8EECB0608}
+ EndGlobalSection
+EndGlobal
diff --git a/v2/rscg_examples/Dirge/src/IDisp/ConnectionDB.cs b/v2/rscg_examples/Dirge/src/IDisp/ConnectionDB.cs
new file mode 100644
index 000000000..3ba510b15
--- /dev/null
+++ b/v2/rscg_examples/Dirge/src/IDisp/ConnectionDB.cs
@@ -0,0 +1,14 @@
+namespace IDisposableGeneratorDemo;
+
+class ConnectionDB : IDisposable
+{
+ static int count = 0;
+ public ConnectionDB()
+ {
+ Interlocked.Increment(ref count);
+ }
+ public void Dispose()
+ {
+ Console.WriteLine($"disposing connectiondb {Interlocked.Decrement(ref count)}");
+ }
+}
diff --git a/v2/rscg_examples/Dirge/src/IDisp/DALDB.cs b/v2/rscg_examples/Dirge/src/IDisp/DALDB.cs
new file mode 100644
index 000000000..9892de90b
--- /dev/null
+++ b/v2/rscg_examples/Dirge/src/IDisp/DALDB.cs
@@ -0,0 +1,15 @@
+namespace IDisposableGeneratorDemo;
+
+[Dirge.AutoDispose]
+partial class DALDB
+{
+ private ConnectionDB cn;
+ private ConnectionDB cn1;
+
+ public DALDB()
+ {
+ cn = new ConnectionDB();
+ cn1=new ConnectionDB();
+ }
+
+}
diff --git a/v2/rscg_examples/Dirge/src/IDisp/IDisp.csproj b/v2/rscg_examples/Dirge/src/IDisp/IDisp.csproj
new file mode 100644
index 000000000..18cbd26b0
--- /dev/null
+++ b/v2/rscg_examples/Dirge/src/IDisp/IDisp.csproj
@@ -0,0 +1,20 @@
+
+
+
+ Exe
+ net10.0
+ enable
+ enable
+
+
+ true
+ $(BaseIntermediateOutputPath)\GX
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
diff --git a/v2/rscg_examples/Dirge/src/IDisp/Program.cs b/v2/rscg_examples/Dirge/src/IDisp/Program.cs
new file mode 100644
index 000000000..601e1dcde
--- /dev/null
+++ b/v2/rscg_examples/Dirge/src/IDisp/Program.cs
@@ -0,0 +1,7 @@
+using IDisposableGeneratorDemo;
+//https://github.com/benutomo-dev/RoslynComponents
+using (var db = new DALDB())
+{
+ Console.WriteLine("before releasing");
+}
+Console.WriteLine("after releasing");
\ No newline at end of file
diff --git a/v2/rscg_examples/Dirge/video.json b/v2/rscg_examples/Dirge/video.json
new file mode 100644
index 000000000..c1388bbcb
--- /dev/null
+++ b/v2/rscg_examples/Dirge/video.json
@@ -0,0 +1,39 @@
+{
+ "scriptName": "Dirge",
+ "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 Dirge . **Dirge** is a Roslyn-based code generator that automatically implements the `IDisposable` pattern for C# classes.Key Features:1. **AutoDispose Attribute**: Mark any partial class with `[AutoDispose]` to automatically generate `Dispose()` and `Dispose(bool)` methods.2. **Automatic Field Disposal**: The generator detects all disposable fields and automatically calls `.Dispose()` on them in the correct order. ."},
+{"typeStep":"browser","arg":"https://www.nuget.org/packages/Dirge/"},
+{"typeStep":"text","arg": "The whole example is here"},
+{"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/Dirge"},
+{"typeStep":"text","arg": "You can download the code from here"},
+{"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/Dirge#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\\Dirge\\src\\IDisp.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\\Dirge\\src"},
+
+{"typeStep":"text","arg": "To use it ,you will put the Nuget Dirge into the csproj "},
+
+{"typeStep":"stepvscode","arg": "-r -g D:\\gth\\RSCG_Examples\\v2\\rscg_examples\\Dirge\\src\\IDisp\\IDisp.csproj"},
+
+{"typeStep":"text","arg": "And now I will show you an example of using Dirge"},
+
+{"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":"IDisp.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/Dirge#download-example-net--c-",
+SpeakTest=" "},
+{"typeStep":"waitseconds","arg":"30"},
+]
+}
diff --git a/v2/rscg_examples_site/docs/Authors/Kazuki_Kohzuki.md b/v2/rscg_examples_site/docs/Authors/Kazuki_Kohzuki.md
new file mode 100644
index 000000000..f7d6ce88e
--- /dev/null
+++ b/v2/rscg_examples_site/docs/Authors/Kazuki_Kohzuki.md
@@ -0,0 +1,7 @@
+# Author : Kazuki Kohzuki
+
+Number RSCG: 1
+
+
+ 1 [Dirge](/docs/Dirge) [](https://www.nuget.org/packages/Dirge/)  2026-07-01
+
diff --git a/v2/rscg_examples_site/docs/Categories/Disposer.md b/v2/rscg_examples_site/docs/Categories/Disposer.md
index 3eeb1f3c8..d5225746d 100644
--- a/v2/rscg_examples_site/docs/Categories/Disposer.md
+++ b/v2/rscg_examples_site/docs/Categories/Disposer.md
@@ -1,16 +1,18 @@
Disposer
-Number RSCG: 6
+Number RSCG: 7
1 [BenutomoAutomaticDisposeImplSourceGenerator](/docs/BenutomoAutomaticDisposeImplSourceGenerator) [](https://www.nuget.org/packages/Benutomo.AutomaticDisposeImpl.SourceGenerator/)  2023-08-15
2 [Coplt.Dropping](/docs/Coplt.Dropping) [](https://www.nuget.org/packages/Coplt.Dropping/)  2024-08-13
- 3 [DisposableHelpers](/docs/DisposableHelpers) [](https://www.nuget.org/packages/DisposableHelpers/)  2023-10-09
+ 3 [Dirge](/docs/Dirge) [](https://www.nuget.org/packages/Dirge/)  2026-07-01
- 4 [Disposer](/docs/Disposer) [](https://www.nuget.org/packages/Disposer/)  2023-10-03
+ 4 [DisposableHelpers](/docs/DisposableHelpers) [](https://www.nuget.org/packages/DisposableHelpers/)  2023-10-09
- 5 [GenerateDispose](/docs/GenerateDispose) [](https://www.nuget.org/packages/GenerateDispose/)  2026-05-13
+ 5 [Disposer](/docs/Disposer) [](https://www.nuget.org/packages/Disposer/)  2023-10-03
- 6 [IDisposableGenerator](/docs/IDisposableGenerator) [](https://www.nuget.org/packages/IDisposableGenerator/)  2023-10-11
+ 6 [GenerateDispose](/docs/GenerateDispose) [](https://www.nuget.org/packages/GenerateDispose/)  2026-05-13
+
+ 7 [IDisposableGenerator](/docs/IDisposableGenerator) [](https://www.nuget.org/packages/IDisposableGenerator/)  2023-10-11
\ No newline at end of file
diff --git a/v2/rscg_examples_site/docs/Categories/_PrimitiveDisposer.mdx b/v2/rscg_examples_site/docs/Categories/_PrimitiveDisposer.mdx
index 8b37e66c7..28fda18bb 100644
--- a/v2/rscg_examples_site/docs/Categories/_PrimitiveDisposer.mdx
+++ b/v2/rscg_examples_site/docs/Categories/_PrimitiveDisposer.mdx
@@ -4,13 +4,15 @@
2 [Coplt.Dropping](/docs/Coplt.Dropping) [](https://www.nuget.org/packages/Coplt.Dropping/)  2024-08-13
- 3 [DisposableHelpers](/docs/DisposableHelpers) [](https://www.nuget.org/packages/DisposableHelpers/)  2023-10-09
+ 3 [Dirge](/docs/Dirge) [](https://www.nuget.org/packages/Dirge/)  2026-07-01
- 4 [Disposer](/docs/Disposer) [](https://www.nuget.org/packages/Disposer/)  2023-10-03
+ 4 [DisposableHelpers](/docs/DisposableHelpers) [](https://www.nuget.org/packages/DisposableHelpers/)  2023-10-09
- 5 [GenerateDispose](/docs/GenerateDispose) [](https://www.nuget.org/packages/GenerateDispose/)  2026-05-13
+ 5 [Disposer](/docs/Disposer) [](https://www.nuget.org/packages/Disposer/)  2023-10-03
- 6 [IDisposableGenerator](/docs/IDisposableGenerator) [](https://www.nuget.org/packages/IDisposableGenerator/)  2023-10-11
+ 6 [GenerateDispose](/docs/GenerateDispose) [](https://www.nuget.org/packages/GenerateDispose/)  2026-05-13
+
+ 7 [IDisposableGenerator](/docs/IDisposableGenerator) [](https://www.nuget.org/packages/IDisposableGenerator/)  2023-10-11
### See category
diff --git a/v2/rscg_examples_site/docs/RSCG-Examples/Dirge.md b/v2/rscg_examples_site/docs/RSCG-Examples/Dirge.md
new file mode 100644
index 000000000..d299ddb0b
--- /dev/null
+++ b/v2/rscg_examples_site/docs/RSCG-Examples/Dirge.md
@@ -0,0 +1,540 @@
+---
+sidebar_position: 2740
+title: 274 - Dirge
+description: Generating IDisposable automatically for any fields.
+slug: /Dirge
+---
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+import TOCInline from '@theme/TOCInline';
+import SameCategory from '../Categories/_PrimitiveDisposer.mdx';
+
+# Dirge by Kazuki Kohzuki
+
+
+
+
+## NuGet / site data
+[](https://www.nuget.org/packages/Dirge/)
+[](https://github.com/IkuzakIkuzok/Dirge)
+
+
+## Details
+
+### Info
+:::info
+
+Name: **Dirge**
+
+Disposable Implementation Roslyn Generator Extension
+
+Author: Kazuki Kohzuki
+
+NuGet:
+*https://www.nuget.org/packages/Dirge/*
+
+
+You can find more details at https://github.com/IkuzakIkuzok/Dirge
+
+Source: https://github.com/IkuzakIkuzok/Dirge
+
+:::
+
+### Author
+:::note
+Kazuki Kohzuki
+
+:::
+
+## Original Readme
+:::note
+
+
+### Dirge
+
+[](https://github.com/IkuzakIkuzok/Dirge/actions/workflows/Test.yml)
+[](https://www.nuget.org/packages/Dirge/#versions-body-tab)
+[](https://www.nuget.org/packages/Dirge/#versions-body-tab)
+[](https://github.com/IkuzakIkuzok/Dirge/blob/main/LICENSE)
+
+Disposable Implementation Roslyn Generator Extension
+###### Installation
+
+You can install the EnumSerializer from [NuGet](https://www.nuget.org/packages/Dirge/).
+
+###### Usage
+
+Mark a class with the `[AutoDispose]` attribute and implement the `IDisposable` interface.
+The generator will automatically generate the implementation of the `Dispose` method for you.
+
+```C#
+using Dirge;
+
+namespace Test;
+
+[AutoDispose]
+internal partial class TestClass
+{
+ private readonly Stream _stream = new MemoryStream();
+}
+```
+
+The generated code will look like this:
+```C#
+namespace Test;
+
+partial class TestClass : IDisposable
+{
+ private bool __generated_disposed = false;
+
+ public void Dispose()
+ {
+ Dispose(true);
+ global::System.GC.SuppressFinalize(this);
+ }
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (this.__generated_disposed) return;
+
+ try
+ {
+ if (disposing)
+ {
+ this._stream?.Dispose();
+ }
+ }
+ finally
+ {
+ this.__generated_disposed = true;
+ }
+ }
+}
+```
+
+Note that this example is simplified for demonstration purposes.
+
+To suppress the auto-generated Dispose call for a specific field, you can use the `[DoNotDispose]` attribute:
+```C#
+using Dirge;
+
+namespace Test;
+
+[AutoDispose]
+internal partial class TestClass
+{
+ private readonly Stream _stream1 = new MemoryStream();
+
+ [DoNotDispose]
+ private readonly Stream _stream2 = new MemoryStream(); // This field will not be disposed by the generated Dispose method.
+}
+```
+
+Ref-struct is also supported, but `IDisposable` will not be implemented regardless of the language version.
+
+######### Conditional disposal
+
+Conditional disposal, which allows you to specify conditions under which a field should be disposed, is also supported.
+You can use the `[DoNotDisposeWhen]` attribute with a boolean field and a value to compare against:
+```C#
+using Dirge;
+
+namespace Test;
+
+[AutoDispose]
+internal partial class TestClass
+{
+ private readonly bool _leaveOpen;
+
+ [DoNotDisposeWhen(nameof(_leaveOpen), true)]
+ private readonly Stream _stream;
+
+ internal TestClass(Stream stream, bool leaveOpen)
+ {
+ this._stream = stream;
+ this._leaveOpen = leaveOpen;
+ }
+}
+```
+
+This will prevent the generator from disposing the `_stream` field when the `_leaveOpen` field is `true`:
+```C#
+namespace Test;
+
+partial class TestClass : IDisposable
+{
+ private bool __generated_disposed = false;
+
+ public void Dispose()
+ {
+ Dispose(true);
+ global::System.GC.SuppressFinalize(this);
+ }
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (this.__generated_disposed) return;
+
+ try
+ {
+ if (disposing)
+ {
+ if (!this._leaveOpen)
+ {
+ this._stream?.Dispose();
+ }
+ }
+ }
+ finally
+ {
+ this.__generated_disposed = true;
+ }
+ }
+}
+```
+
+######### Unmanaged resources
+
+To safely release unmanaged resources, this generator also supports the implementation of a finalizer.
+You can specify a method to release unmanaged resources through the `ReleaseUnmanagedResources` option:
+```C#
+using Dirge;
+using System.IO;
+
+namespace Test;
+
+[AutoDispose(ReleaseUnmanagedResources = nameof(ReleaseUnmanagedResources))]
+internal sealed partial class TestClass
+{
+ private readonly Stream _stream;
+
+ internal void ReleaseUnmanagedResources()
+ {
+ // Custom logic to release unmanaged resources
+ }
+}
+```
+
+This will generate a finalizer that calls the specified method to release unmanaged resources:
+```C#
+namespace Test;
+
+sealed partial class TestClass : IDisposable
+{
+ private bool __generated_disposed = false;
+
+ public void Dispose()
+ {
+ Dispose(true);
+ global::System.GC.SuppressFinalize(this);
+ }
+
+ private void Dispose(bool disposing)
+ {
+ if (this.__generated_disposed) return;
+
+ try
+ {
+ if (disposing)
+ {
+ this._stream?.Dispose();
+ }
+
+ ReleaseUnmanagedResources();
+ }
+ finally
+ {
+ this.__generated_disposed = true;
+ }
+ }
+
+ ~TestClass()
+ {
+ Dispose(false);
+ }
+}
+```
+
+###### Constraints
+
+To generate the `Dispose` method, the class (or struct) must meet the following constraints:
+- It must be a non-static class.
+- It must be a partial class or struct.
+- It must not be a readonly struct.
+
+For conditional disposal, the field specified in the `nameof` expression must be a boolean field.
+Properties and methods are not supported for the current version.
+
+
+:::
+
+### About
+:::note
+
+
+
+
+
+
+
+**Dirge** is a Roslyn-based code generator that automatically implements the `IDisposable` pattern for C# classes.
+
+
+
+
+
+Key Features:
+
+
+
+
+
+1. **AutoDispose Attribute**: Mark any partial class with `[AutoDispose]` to automatically generate `Dispose()` and `Dispose(bool)` methods.
+
+
+
+
+
+2. **Automatic Field Disposal**: The generator detects all disposable fields and automatically calls `.Dispose()` on them in the correct order.
+
+
+
+
+
+:::
+
+## How to use
+
+### Example (source csproj, source files)
+
+
+
+
+
+This is the CSharp Project that references **Dirge**
+```xml showLineNumbers {14}
+
+
+
+ Exe
+ net10.0
+ enable
+ enable
+
+
+ true
+ $(BaseIntermediateOutputPath)\GX
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+
+```
+
+
+
+
+
+ This is the use of **Dirge** in *Program.cs*
+
+```csharp showLineNumbers
+using IDisposableGeneratorDemo;
+//https://github.com/benutomo-dev/RoslynComponents
+using (var db = new DALDB())
+{
+ Console.WriteLine("before releasing");
+}
+Console.WriteLine("after releasing");
+```
+
+
+
+
+ This is the use of **Dirge** in *DALDB.cs*
+
+```csharp showLineNumbers
+namespace IDisposableGeneratorDemo;
+
+[Dirge.AutoDispose]
+partial class DALDB
+{
+ private ConnectionDB cn;
+ private ConnectionDB cn1;
+
+ public DALDB()
+ {
+ cn = new ConnectionDB();
+ cn1=new ConnectionDB();
+ }
+
+}
+
+```
+
+
+
+
+ This is the use of **Dirge** in *ConnectionDB.cs*
+
+```csharp showLineNumbers
+namespace IDisposableGeneratorDemo;
+
+class ConnectionDB : IDisposable
+{
+ static int count = 0;
+ public ConnectionDB()
+ {
+ Interlocked.Increment(ref count);
+ }
+ public void Dispose()
+ {
+ Console.WriteLine($"disposing connectiondb {Interlocked.Decrement(ref count)}");
+ }
+}
+
+```
+
+
+
+
+### Generated Files
+
+Those are taken from $(BaseIntermediateOutputPath)\GX
+
+
+
+
+```csharp showLineNumbers
+//
+
+#pragma warning disable CS0282
+
+namespace IDisposableGeneratorDemo
+{
+ partial class DALDB : global::System.IDisposable
+ {
+ [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
+ [global::System.Diagnostics.DebuggerBrowsable(global::System.Diagnostics.DebuggerBrowsableState.Never)]
+ [global::System.Runtime.CompilerServices.CompilerGenerated]
+ private bool __generated_disposed = false;
+
+ public void Dispose()
+ {
+ Dispose(true);
+ global::System.GC.SuppressFinalize(this);
+ }
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (this.__generated_disposed) return;
+
+ try
+ {
+ if (disposing)
+ {
+ this.cn?.Dispose();
+ this.cn1?.Dispose();
+ }
+ }
+ finally
+ {
+ this.__generated_disposed = true;
+ }
+ }
+ }
+}
+
+```
+
+
+
+
+```csharp showLineNumbers
+//
+
+#nullable enable
+
+namespace Dirge
+{
+ [global::System.AttributeUsage(global::System.AttributeTargets.Class | global::System.AttributeTargets.Struct, Inherited = false, AllowMultiple = false)]
+ internal sealed class AutoDisposeAttribute : global::System.Attribute
+ {
+ public string? ReleaseUnmanagedResources \{ get; set; \} = null;
+
+ internal AutoDisposeAttribute() \{ }
+ }
+}
+```
+
+
+
+
+```csharp showLineNumbers
+//
+
+namespace Dirge
+{
+ [global::System.AttributeUsage(global::System.AttributeTargets.Field, Inherited = false, AllowMultiple = false)]
+ internal sealed class DoNotDisposeAttribute : global::System.Attribute
+ {
+ internal DoNotDisposeAttribute() \{ }
+ }
+}
+```
+
+
+
+
+```csharp showLineNumbers
+//
+
+namespace Dirge
+{
+ [global::System.AttributeUsage(global::System.AttributeTargets.Field, Inherited = false, AllowMultiple = false)]
+ internal sealed class DoNotDisposeWhenAttribute : global::System.Attribute
+ {
+ internal string FlagName \{ get; }
+
+ internal bool FlagCondition \{ get; }
+
+ internal DoNotDisposeWhenAttribute(string flagName, bool flagCondition)
+ {
+ this.FlagName = flagName;
+ this.FlagCondition = flagCondition;
+ }
+ }
+}
+```
+
+
+
+
+## Useful
+
+### Download Example (.NET C#)
+
+:::tip
+
+[Download Example project Dirge ](/sources/Dirge.zip)
+
+:::
+
+
+### Share Dirge
+
+
+
+https://ignatandrei.github.io/RSCG_Examples/v2/docs/Dirge
+
+
+
diff --git a/v2/rscg_examples_site/docs/RSCG-Examples/index.md b/v2/rscg_examples_site/docs/RSCG-Examples/index.md
index 077f13dfe..72f56ad82 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: 273 RSCG list by category
-description: 273 RSCG list by category
+title: 274 RSCG list by category
+description: 274 RSCG list by category
slug: /rscg-examples
---
@@ -514,7 +514,7 @@ import DocCardList from '@theme/DocCardList';
## Disposer
- Expand Disposer =>examples:6
+ Expand Disposer =>examples:7
@@ -545,6 +545,11 @@ import DocCardList from '@theme/DocCardList';
[GenerateDispose](/docs/GenerateDispose)
+
+
+
+[Dirge](/docs/Dirge)
+
@@ -1871,6 +1876,8 @@ flowchart LR;
Disposer--> GenerateDispose((GenerateDispose))
+ Disposer--> Dirge((Dirge))
+
Documentation--> REslava.ResultFlow((REslava.ResultFlow))
EnhancementClass--> System.Text.RegularExpressions((System.Text.RegularExpressions))
diff --git a/v2/rscg_examples_site/docs/about.md b/v2/rscg_examples_site/docs/about.md
index cbace812c..3a0d1969d 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 273 Roslyn Source Code Generator (RSCG)
+of 274 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 93c630289..c8ed1828c 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';
-## 273 RSCG with examples in descending chronological order
+## 274 RSCG with examples in descending chronological order
-This is the list of 273 ( 16 from Microsoft) RSCG with examples
+This is the list of 274 ( 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 273 ( 16 from Microsoft) RSCG with examples
| No | Name | Date | Category |
| --------- | ----- | ---- | -------- |
+|274| [Dirge by Kazuki Kohzuki ](/docs/Dirge)|2026-07-01 => 01 July 2026 | [Disposer](/docs/Categories/Disposer) |
|273| [ScottEncodingGenerator by Georgiy Petrov ](/docs/ScottEncodingGenerator)|2026-06-30 => 30 June 2026 | [FunctionalProgramming](/docs/Categories/FunctionalProgramming) |
|272| [AlephMapper by Yevhen Cherkes ](/docs/AlephMapper)|2026-06-29 => 29 June 2026 | [Database](/docs/Categories/Database) |
|271| [TypedStateBuilder.Generator by Georgiy Petrov ](/docs/TypedStateBuilder.Generator)|2026-05-16 => 16 May 2026 | [Builder](/docs/Categories/Builder) |
diff --git a/v2/rscg_examples_site/src/components/HomepageFeatures/index.js b/v2/rscg_examples_site/src/components/HomepageFeatures/index.js
index efb5ae47c..37f1ee269 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: '273 Examples (16 from MSFT)',
+title: '274 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 6b6fc2682..ca247ae61 100644
--- a/v2/rscg_examples_site/static/exports/RSCG.json
+++ b/v2/rscg_examples_site/static/exports/RSCG.json
@@ -2185,6 +2185,14 @@
"Source": "https://github.com/Georgiy-Petrov/ScottEncodingGenerator",
"Category": "FunctionalProgramming",
"AddedOn": "2026-06-30T00:00:00"
+ },
+ {
+ "Name": "Dirge",
+ "Link": "https://ignatandrei.github.io/RSCG_Examples/v2/docs/Dirge",
+ "NuGet": "https://www.nuget.org/packages/Dirge/",
+ "Source": "https://github.com/IkuzakIkuzok/Dirge",
+ "Category": "Disposer",
+ "AddedOn": "2026-07-01T00:00:00"
}
]
}
\ No newline at end of file
diff --git a/v2/rscg_examples_site/static/sources/Dirge.zip b/v2/rscg_examples_site/static/sources/Dirge.zip
new file mode 100644
index 000000000..9603ea71c
Binary files /dev/null and b/v2/rscg_examples_site/static/sources/Dirge.zip differ