diff --git a/README.md b/README.md index fe7373c91..86a87e4e2 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ -# RSCG - 234 Examples of Roslyn Source Code Generators / 14 created by Microsoft / +# RSCG - 235 Examples of Roslyn Source Code Generators / 14 created by Microsoft / -The RSCG_Examples repository is a comprehensive documentation system that automatically processes and showcases 234 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 235 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-10-04 => 04 October 2025 +## Latest Update : 2025-10-05 => 05 October 2025 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 234 Roslyn Source Code Generators that I have tested you can see and download source code example. +Those are the 235 Roslyn Source Code Generators that I have tested you can see and download source code example. ( including 14 from Microsoft ) +### 235. [Csvcsharp](https://ignatandrei.github.io/RSCG_Examples/v2/docs/Csvcsharp) , in the [Serializer](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#serializer) category + +Generated on : 2025-10-05 => 05 October 2025 + +
+ Expand + + + +Author: Yusuke Nakada + +Fast CSV Serializer for .NET and Unity. + +Nuget: [https://www.nuget.org/packages/Csvcsharp/](https://www.nuget.org/packages/Csvcsharp/) + + +Link: [https://ignatandrei.github.io/RSCG_Examples/v2/docs/Csvcsharp](https://ignatandrei.github.io/RSCG_Examples/v2/docs/Csvcsharp) + +Source: [https://github.com/nuskey8/Csv-CSharp](https://github.com/nuskey8/Csv-CSharp) + +
+ ### 234. [RapidEnum](https://ignatandrei.github.io/RSCG_Examples/v2/docs/RapidEnum) , in the [Enum](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#enum) category Generated on : 2025-10-04 => 04 October 2025 diff --git a/later.md b/later.md index c787ce0c2..6835fb263 100644 --- a/later.md +++ b/later.md @@ -1,6 +1,6 @@ # Just later -## Latest Update : 2025-10-04 => 04 October 2025 +## Latest Update : 2025-10-05 => 05 October 2025 diff --git a/v2/Generator/DocusaurusExample.txt b/v2/Generator/DocusaurusExample.txt index 60b9aff91..270eff4d3 100644 --- a/v2/Generator/DocusaurusExample.txt +++ b/v2/Generator/DocusaurusExample.txt @@ -12,7 +12,7 @@ import SameCategory from '../Categories/_Primitive{{category}}.mdx'; # {{ Description.Generator.Name }} by {{Description.Generator.Author}} - + ## NuGet / site data {{Description.Generator.MarkDownNugetDownloads}} diff --git a/v2/Generator/all.csv b/v2/Generator/all.csv index 0e7736f0c..1e2817f31 100644 --- a/v2/Generator/all.csv +++ b/v2/Generator/all.csv @@ -233,3 +233,4 @@ Nr,Key,Source,Category 232,ConsoleAppFramework, https://github.com/Cysharp/ConsoleAppFramework,Console 233,Vyaml, https://github.com/hadashiA/VYaml,Serializer 234,RapidEnum, https://github.com/hanachiru/RapidEnum,Enum +235,CsvCsharp, https://github.com/nuskey8/Csv-CSharp,Serializer diff --git a/v2/RSCGExamplesData/GeneratorDataRec.json b/v2/RSCGExamplesData/GeneratorDataRec.json index daa2aa0a0..cd33c9e69 100644 --- a/v2/RSCGExamplesData/GeneratorDataRec.json +++ b/v2/RSCGExamplesData/GeneratorDataRec.json @@ -1414,5 +1414,12 @@ "Category":19, "dtStart": "2025-10-04T00:00:00", "show": true +}, + +{ + "ID":"CsvCsharp", + "Category":16, + "dtStart": "2025-10-05T00:00:00", + "show": true } ] \ No newline at end of file diff --git a/v2/book/examples/Csvcsharp.html b/v2/book/examples/Csvcsharp.html new file mode 100644 index 000000000..9426019a4 --- /dev/null +++ b/v2/book/examples/Csvcsharp.html @@ -0,0 +1,64 @@ + +

RSCG nr 235 : Csvcsharp

+ +

Info

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

You can find more details at : https://github.com/nuskey8/Csv-CSharp

+ +

Author :Yusuke Nakada

+ +

Source: https://github.com/nuskey8/Csv-CSharp

+ +

About

+ +Serializer for CSV files + +

+ How to use +

+

+ Add reference to the Csvcsharp in the csproj +

+ + +

This was for me the starting code

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

And here are the generated files

+ +
+ The file generated is SerializerDemo.Person.CsvSerializer.g.cs +
+ + +
+ The file generated is SerializerDemo.Person.YamlFormatter.g.cs +
+ + +

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

+ + +

+ 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 c91062462..fa1d0a1b8 100644 --- a/v2/book/list.html +++ b/v2/book/list.html @@ -17,7 +17,7 @@

-This is the list of 234 RSCG with examples => +This is the list of 235 RSCG with examples =>

@@ -962,6 +962,10 @@

+ + + +
234 RapidEnum
235Csvcsharp
diff --git a/v2/book/pandocHTML.yaml b/v2/book/pandocHTML.yaml index 8e2e58887..821208e52 100644 --- a/v2/book/pandocHTML.yaml +++ b/v2/book/pandocHTML.yaml @@ -248,6 +248,7 @@ input-files: - examples/ConsoleAppFramework.html - examples/VYaml.html - examples/RapidEnum.html +- examples/Csvcsharp.html # or you may use input-file: with a single value # defaults: diff --git a/v2/rscg_examples/CsvCsharp/description.json b/v2/rscg_examples/CsvCsharp/description.json new file mode 100644 index 000000000..ad5795f11 --- /dev/null +++ b/v2/rscg_examples/CsvCsharp/description.json @@ -0,0 +1,22 @@ +{ + "generator":{ + "name":"Csvcsharp", + "nuget":[ + "https://www.nuget.org/packages/Csvcsharp/" + ], + "link":"https://github.com/nuskey8/Csv-CSharp", + "author":"Yusuke Nakada", + "source":"https://github.com/nuskey8/Csv-CSharp" + }, + "data":{ + "goodFor":["Serializer for CSV files"], + "csprojDemo":"Serializer.csproj", + "csFiles":["Program.cs","Person.cs"], + "excludeDirectoryGenerated":[""], + "includeAdditionalFiles":[""] + }, + "links":{ + "blog":"", + "video":"" + } +} \ No newline at end of file diff --git a/v2/rscg_examples/CsvCsharp/nuget.txt b/v2/rscg_examples/CsvCsharp/nuget.txt new file mode 100644 index 000000000..b9099ba26 --- /dev/null +++ b/v2/rscg_examples/CsvCsharp/nuget.txt @@ -0,0 +1 @@ +Fast CSV Serializer for .NET and Unity. \ No newline at end of file diff --git a/v2/rscg_examples/CsvCsharp/readme.txt b/v2/rscg_examples/CsvCsharp/readme.txt new file mode 100644 index 000000000..71024911e --- /dev/null +++ b/v2/rscg_examples/CsvCsharp/readme.txt @@ -0,0 +1,254 @@ +# Csv-CSharp + +[![NuGet](https://img.shields.io/nuget/v/CsvCSharp.svg)](https://www.nuget.org/packages/CsvCSharp) +[![Releases](https://img.shields.io/github/release/nuskey8/Csv-CSharp.svg)](https://github.com/nuskey8/Csv-CSharp/releases) +[![GitHub license](https://img.shields.io/github/license/nuskey8/Csv-CSharp.svg)](./LICENSE) + +English | [日本語](./README_JA.md) + +![img](docs/img1.png) + +Csv-CSharp is a highly performant CSV (TSV) parser for .NET and Unity. It is designed to parse UTF-8 binaries directly and leverage Source Generators to enable serialization/deserialization between CSV (TSV) and object arrays with zero (or very low) allocation. + +## Installation + +### NuGet packages + +Csv-CSharp requires .NET Standard 2.1 or higher. The package can be obtained from NuGet. + +### .NET CLI + +```ps1 +dotnet add package CsvCSharp +``` + +### Package Manager + +```ps1 +Install-Package CsvCSharp +``` + +### Unity + +You can install Csv-CSharp in Unity by using [NugetForUnity](https://github.com/GlitchEnzo/NuGetForUnity). For details, refer to the NugetForUnity README. + +## Quick Start + +Csv-CSharp serializes/deserializes CSV data to and from arrays of classes/structs. + +Define a class/struct and add the `[CsvObject]` attribute and the `partial` keyword. + +```cs +[CsvObject] +public partial class Person +{ + [Column(0)] + public string Name { get; set; } + + [Column(1)] + public int Age { get; set; } +} +``` + +All public fields/properties of a type marked with `[CsvObject]` must have either the `[Column]` or `[IgnoreMember]` attribute. (An analyzer will output a compile error if it does not find either attribute on public members.) + +The `[Column]` attribute can specify a column index as an `int` or a header name as a `string`. + +To serialize this type to CSV or deserialize it from CSV, use `CsvSerializer`. + +```cs +var array = new Person[] +{ + new() { Name = "Alice", Age = 18 }, + new() { Name = "Bob", Age = 23 }, + new() { Name = "Carol", Age = 31 }, +} + +// Person[] -> CSV (UTF-8) +byte[] csv = CsvSerializer.Serialize(array); + +// Person[] -> CSV (UTF-16) +string csvText = CsvSerializer.SerializeToString(array); + +// CSV (UTF-8) -> Person[] +array = CsvSerializer.Deserialize(csv); + +// CSV (UTF-16) -> Person[] +array = CsvSerializer.Deserialize(csvText); +``` + +Serialize has an overload that returns a UTF-8 encoded `byte[]`, and you can also pass a `Stream` or `IBufferWriter` for writing. Deserialize accepts UTF-8 byte arrays as `byte[]` and also supports `string`, `Stream`, and `ReadOnlySequence`. + +The default supported types for fields are `sbyte`, `byte`, `short`, `ushort`, `int`, `uint`, `long`, `ulong`, `char`, `string`, `Enum`, `Nullable`, `DateTime`, `TimeSpan`, and `Guid`. To support other types, refer to the Extensions section. + +## Serialization + +The class/struct passed to `CsvSerializer` should have the `[CsvObject]` attribute and the `partial` keyword. + +By default, fields and properties with the `[Column]` attribute are the targets for serialization/deserialization. The `[Column]` attribute is mandatory for public members, but you can target private members by adding the `[Column]` attribute. + +```cs +[CsvObject] +public partial class Person +{ + [Column(0)] + public string Name { get; set; } + + [Column(1)] + int age; + + [IgnoreMember] + public int Age => age; +} +``` + +To specify header names instead of indices, use a string key. + +```cs +[CsvObject] +public partial class Person +{ + [Column("name")] + public string Name { get; set; } + + [Column("age")] + public int Age { get; set; } +} +``` + +To use member names as keys, specify `[CsvObject(keyAsPropertyName: true)]`. In this case, the `[Column]` attribute is not required. + +```cs +[CsvObject(keyAsPropertyName: true)] +public partial class Person +{ + public string Name { get; set; } + public int Age { get; set; } +} +``` + +## CsvDocument + +If you need to directly parse CSV fields, you can use `CsvDocument`. + +```cs +var array = new Person[] +{ + new() { Name = "Alice", Age = 18 }, + new() { Name = "Bob", Age = 23 }, + new() { Name = "Carol", Age = 31 }, +}; + +byte[] csv = CsvSerializer.Serialize(array); + +// CSV (UTF-8) -> CsvDocument +var document = CsvSerializer.ConvertToDocument(csv); + +foreach (var row in document.Rows) +{ + var name = row["Name"].GetValue(); + var age = row["Age"].GetValue(); +} +``` + +## Options + +You can change CSV settings by passing `CsvOptions` to Serialize/Deserialize. + +```cs +CsvSerializer.Serialize(array, new CsvOptions() +{ + HasHeader = true, // Include header row + AllowComments = true, // Allow comments starting with '#'' + NewLine = NewLineType.LF, // Newline type + Separator = SeparatorType.Comma, // Separator character + QuoteMode = QuoteMode.Minimal, // Conditions for quoting fields (Minimal quotes only strings containing escape characters) + FormatterProvider = StandardFormatterProvider.Instance, // ICsvFormatterProvider to use +}); +``` + +## CSV Specifications + +The default settings of Csv-CSharp generally follow the specifications outlined in [RFC 4180](https://www.rfc-editor.org/rfc/rfc4180.html). However, please note that for performance and practicality reasons, some specifications may be disregarded. + +- The default newline character is LF instead of CRLF. +- Records with a mismatch in the number of fields can be read without errors being output; missing fields will be set to their default values. + +## Extensions + +Interfaces `ICsvFormatter` and `ICsvFormatterProvider` are provided to customize field serialization/deserialization. + +Use `ICsvFormatter` for type serialization/deserialization. Here is an example of implementing a formatter for a struct wrapping an `int`. + +```cs +public struct Foo +{ + public int Value; + + public Foo(int value) + { + this.Value = value; + } +} + +public sealed class FooFormatter : ICsvFormatter +{ + public Foo Deserialize(ref CsvReader reader) + { + var value = reader.ReadInt32(); + return new Foo(value); + } + + public void Serialize(ref CsvWriter writer, Foo value) + { + writer.WriteInt32(value.Value); + } +} +``` + +Next, implement a formatter provider to retrieve the formatter. + +```cs +public class CustomFormatterProvider : ICsvFormatterProvider +{ + public static readonly ICsvFormatterProvider Instance = new CustomFormatterProvider(); + + CustomFormatterProvider() + { + } + + static CustomFormatterProvider() + { + FormatterCache.Formatter = new FooFormatter(); + } + + public ICsvFormatter? GetFormatter() + { + return FormatterCache.Formatter; + } + + static class FormatterCache + { + public static readonly ICsvFormatter Formatter; + } +} +``` + +You can set the created formatter provider in CsvOptions. The above `CustomFormatterProvider` only supports the `Foo` struct, so combine it with the standard formatter provider `StandardFormatterProvider`. + +```cs +// Create a composite formatter provider combining multiple formatter providers +var provider = CompositeFormatterProvider.Create( + CustomFormatterProvider.Instance, + StandardFormatterProvider.Instance +); + +CsvSerializer.Serialize(array, new CsvOptions() +{ + FormatterProvider = provider +}); +``` + +## License + +This library is released under the MIT license. \ No newline at end of file diff --git a/v2/rscg_examples/CsvCsharp/src/.tours/Csvcsharp.tour b/v2/rscg_examples/CsvCsharp/src/.tours/Csvcsharp.tour new file mode 100644 index 000000000..a3ab6f924 --- /dev/null +++ b/v2/rscg_examples/CsvCsharp/src/.tours/Csvcsharp.tour @@ -0,0 +1,42 @@ + +{ + "$schema": "https://aka.ms/codetour-schema", + "title": "Csvcsharp", + "steps": + [ + { + "file": "Serializer/Serializer.csproj", + "description": "First, we add Nuget [Csvcsharp](https://www.nuget.org/packages/Csvcsharp/) in csproj ", + "pattern": "Csvcsharp" + } + + ,{ + "file": "Serializer/Person.cs", + "description": "File Person.cs ", + "pattern": "this is the code" + } + + ,{ + "file": "Serializer/Program.cs", + "description": "File Program.cs \r\n>> dotnet run --project Serializer/Serializer.csproj ", + "pattern": "this is the code" + } + + + ,{ + "file": "Serializer/obj/GX/VYaml.SourceGenerator/VYaml.SourceGenerator.VYamlIncrementalSourceGenerator/SerializerDemo.Person.YamlFormatter.g.cs", + "description": "Generated File 2 from 2 : SerializerDemo.Person.YamlFormatter.g.cs ", + "line": 1 + } + + ,{ + "file": "Serializer/obj/GX/Csv.SourceGenerator/Csv.SourceGenerator.CsvSerializerGenerator/SerializerDemo.Person.CsvSerializer.g.cs", + "description": "Generated File 1 from 2 : SerializerDemo.Person.CsvSerializer.g.cs ", + "line": 1 + } + + ], + + "ref": "main" + +} \ No newline at end of file diff --git a/v2/rscg_examples/CsvCsharp/src/Serializer.sln b/v2/rscg_examples/CsvCsharp/src/Serializer.sln new file mode 100644 index 000000000..40466f7c7 --- /dev/null +++ b/v2/rscg_examples/CsvCsharp/src/Serializer.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.7.34031.279 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Serializer", "Serializer\Serializer.csproj", "{7FC58895-BFD9-892B-A3D5-1812858E3D58}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7FC58895-BFD9-892B-A3D5-1812858E3D58}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7FC58895-BFD9-892B-A3D5-1812858E3D58}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7FC58895-BFD9-892B-A3D5-1812858E3D58}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7FC58895-BFD9-892B-A3D5-1812858E3D58}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {13C14387-12AE-4C73-9EBA-2D145CD7C194} + EndGlobalSection +EndGlobal diff --git a/v2/rscg_examples/CsvCsharp/src/Serializer/Person.cs b/v2/rscg_examples/CsvCsharp/src/Serializer/Person.cs new file mode 100644 index 000000000..8f31d22ee --- /dev/null +++ b/v2/rscg_examples/CsvCsharp/src/Serializer/Person.cs @@ -0,0 +1,13 @@ +using Csv.Annotations; + +namespace SerializerDemo; +[CsvObject] +public partial class Person +{ + [Column(0)] + public int Age { get; set; } + [Column(1)] + public string Name { get; set; } = string.Empty; + +} + diff --git a/v2/rscg_examples/CsvCsharp/src/Serializer/Program.cs b/v2/rscg_examples/CsvCsharp/src/Serializer/Program.cs new file mode 100644 index 000000000..69048321a --- /dev/null +++ b/v2/rscg_examples/CsvCsharp/src/Serializer/Program.cs @@ -0,0 +1,11 @@ +using Csv; +using SerializerDemo; + +var p= new Person() { Name= "Andrei Ignat" , Age=55}; +var utf8Csv = CsvSerializer.SerializeToString([p]); +Console.WriteLine(utf8Csv); +var p1 = CsvSerializer.Serialize([p]); +var p2 = CsvSerializer.Deserialize(p1); + +Console.WriteLine(p2.First().Name); +Console.WriteLine(p2.First().Age); \ No newline at end of file diff --git a/v2/rscg_examples/CsvCsharp/src/Serializer/Serializer.csproj b/v2/rscg_examples/CsvCsharp/src/Serializer/Serializer.csproj new file mode 100644 index 000000000..70be1ba7e --- /dev/null +++ b/v2/rscg_examples/CsvCsharp/src/Serializer/Serializer.csproj @@ -0,0 +1,17 @@ + + + + Exe + net9.0 + enable + enable + + + true + $(BaseIntermediateOutputPath)\GX + + + + + + diff --git a/v2/rscg_examples/CsvCsharp/video.json b/v2/rscg_examples/CsvCsharp/video.json new file mode 100644 index 000000000..2b3c788c9 --- /dev/null +++ b/v2/rscg_examples/CsvCsharp/video.json @@ -0,0 +1,39 @@ +{ + "scriptName": "Csvcsharp", + "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 Csvcsharp . Serializer for CSV files ."}, +{"typeStep":"browser","arg":"https://www.nuget.org/packages/Csvcsharp/"}, +{"typeStep":"text","arg": "The whole example is here"}, +{"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/Csvcsharp"}, +{"typeStep":"text","arg": "You can download the code from here"}, +{"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/Csvcsharp#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\\CsvCsharp\\src\\Serializer.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\\CsvCsharp\\src"}, + +{"typeStep":"text","arg": "To use it ,you will put the Nuget Csvcsharp into the csproj "}, + +{"typeStep":"stepvscode","arg": "-r -g D:\\gth\\RSCG_Examples\\v2\\rscg_examples\\CsvCsharp\\src\\Serializer\\Serializer.csproj"}, + +{"typeStep":"text","arg": "And now I will show you an example of using Csvcsharp"}, + +{"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":"Serializer.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/Csvcsharp#download-example-net--c-", +SpeakTest=" "}, +{"typeStep":"waitseconds","arg":"30"}, +] +} diff --git a/v2/rscg_examples_site/docs/Categories/Serializer.md b/v2/rscg_examples_site/docs/Categories/Serializer.md index 82ad727ca..74eb28476 100644 --- a/v2/rscg_examples_site/docs/Categories/Serializer.md +++ b/v2/rscg_examples_site/docs/Categories/Serializer.md @@ -1,22 +1,24 @@

Serializer

-Number RSCG: 9 +Number RSCG: 10 - 1 [GenPack](/docs/GenPack) + 1 [Csvcsharp](/docs/Csvcsharp) - 2 [jsonConverterSourceGenerator](/docs/jsonConverterSourceGenerator) + 2 [GenPack](/docs/GenPack) - 3 [JsonPolymorphicGenerator](/docs/JsonPolymorphicGenerator) + 3 [jsonConverterSourceGenerator](/docs/jsonConverterSourceGenerator) - 4 [Nino](/docs/Nino) + 4 [JsonPolymorphicGenerator](/docs/JsonPolymorphicGenerator) - 5 [ProtobufSourceGenerator](/docs/ProtobufSourceGenerator) + 5 [Nino](/docs/Nino) - 6 [Schema](/docs/Schema) + 6 [ProtobufSourceGenerator](/docs/ProtobufSourceGenerator) - 7 [StackXML](/docs/StackXML) + 7 [Schema](/docs/Schema) - 8 [System.Text.Json](/docs/System.Text.Json) + 8 [StackXML](/docs/StackXML) - 9 [VYaml](/docs/VYaml) + 9 [System.Text.Json](/docs/System.Text.Json) + + 10 [VYaml](/docs/VYaml) \ No newline at end of file diff --git a/v2/rscg_examples_site/docs/Categories/_PrimitiveSerializer.mdx b/v2/rscg_examples_site/docs/Categories/_PrimitiveSerializer.mdx index 3648292e1..788a0f03f 100644 --- a/v2/rscg_examples_site/docs/Categories/_PrimitiveSerializer.mdx +++ b/v2/rscg_examples_site/docs/Categories/_PrimitiveSerializer.mdx @@ -1,22 +1,24 @@ ### Category "Serializer" has the following generators: - 1 [GenPack](/docs/GenPack) + 1 [Csvcsharp](/docs/Csvcsharp) - 2 [jsonConverterSourceGenerator](/docs/jsonConverterSourceGenerator) + 2 [GenPack](/docs/GenPack) - 3 [JsonPolymorphicGenerator](/docs/JsonPolymorphicGenerator) + 3 [jsonConverterSourceGenerator](/docs/jsonConverterSourceGenerator) - 4 [Nino](/docs/Nino) + 4 [JsonPolymorphicGenerator](/docs/JsonPolymorphicGenerator) - 5 [ProtobufSourceGenerator](/docs/ProtobufSourceGenerator) + 5 [Nino](/docs/Nino) - 6 [Schema](/docs/Schema) + 6 [ProtobufSourceGenerator](/docs/ProtobufSourceGenerator) - 7 [StackXML](/docs/StackXML) + 7 [Schema](/docs/Schema) - 8 [System.Text.Json](/docs/System.Text.Json) + 8 [StackXML](/docs/StackXML) - 9 [VYaml](/docs/VYaml) + 9 [System.Text.Json](/docs/System.Text.Json) + + 10 [VYaml](/docs/VYaml) ### See category diff --git a/v2/rscg_examples_site/docs/RSCG-Examples/Csvcsharp.md b/v2/rscg_examples_site/docs/RSCG-Examples/Csvcsharp.md new file mode 100644 index 000000000..76248b78c --- /dev/null +++ b/v2/rscg_examples_site/docs/RSCG-Examples/Csvcsharp.md @@ -0,0 +1,766 @@ +--- +sidebar_position: 2350 +title: 235 - Csvcsharp +description: Serializer for CSV files +slug: /Csvcsharp +--- +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; +import TOCInline from '@theme/TOCInline'; +import SameCategory from '../Categories/_PrimitiveSerializer.mdx'; + +# Csvcsharp by Yusuke Nakada + + + + +## NuGet / site data +[![Nuget](https://img.shields.io/nuget/dt/Csvcsharp?label=Csvcsharp)](https://www.nuget.org/packages/Csvcsharp/) +[![GitHub last commit](https://img.shields.io/github/last-commit/nuskey8/Csv-CSharp?label=updated)](https://github.com/nuskey8/Csv-CSharp) +![GitHub Repo stars](https://img.shields.io/github/stars/nuskey8/Csv-CSharp?style=social) + +## Details + +### Info +:::info + +Name: **Csvcsharp** + +Fast CSV Serializer for .NET and Unity. + +Author: Yusuke Nakada + +NuGet: +*https://www.nuget.org/packages/Csvcsharp/* + + +You can find more details at https://github.com/nuskey8/Csv-CSharp + +Source: https://github.com/nuskey8/Csv-CSharp + +::: + +### Author +:::note +Yusuke Nakada +![Alt text](https://github.com/nuskey8.png) +::: + +### Original Readme +:::note + +# Csv-CSharp + +[![NuGet](https://img.shields.io/nuget/v/CsvCSharp.svg)](https://www.nuget.org/packages/CsvCSharp) +[![Releases](https://img.shields.io/github/release/nuskey8/Csv-CSharp.svg)](https://github.com/nuskey8/Csv-CSharp/releases) +[![GitHub license](https://img.shields.io/github/license/nuskey8/Csv-CSharp.svg)](https://github.com/nuskey8/Csv-CSharp/LICENSE) + +English | [日本語](https://github.com/nuskey8/Csv-CSharp/README_JA.md) + +![img](https://github.com/nuskey8/Csv-CSharp/docs/img1.png) + +Csv-CSharp is a highly performant CSV (TSV) parser for .NET and Unity. It is designed to parse UTF-8 binaries directly and leverage Source Generators to enable serialization/deserialization between CSV (TSV) and object arrays with zero (or very low) allocation. + +## Installation + +### NuGet packages + +Csv-CSharp requires .NET Standard 2.1 or higher. The package can be obtained from NuGet. + +### .NET CLI + +```ps1 +dotnet add package CsvCSharp +``` + +### Package Manager + +```ps1 +Install-Package CsvCSharp +``` + +### Unity + +You can install Csv-CSharp in Unity by using [NugetForUnity](https://github.com/GlitchEnzo/NuGetForUnity). For details, refer to the NugetForUnity README. + +## Quick Start + +Csv-CSharp serializes/deserializes CSV data to and from arrays of classes/structs. + +Define a class/struct and add the `[CsvObject]` attribute and the `partial` keyword. + +```cs +[CsvObject] +public partial class Person +{ + [Column(0)] + public string Name \{ get; set; } + + [Column(1)] + public int Age \{ get; set; } +} +``` + +All public fields/properties of a type marked with `[CsvObject]` must have either the `[Column]` or `[IgnoreMember]` attribute. (An analyzer will output a compile error if it does not find either attribute on public members.) + +The `[Column]` attribute can specify a column index as an `int` or a header name as a `string`. + +To serialize this type to CSV or deserialize it from CSV, use `CsvSerializer`. + +```cs +var array = new Person[] +{ + new() \{ Name = "Alice", Age = 18 }, + new() \{ Name = "Bob", Age = 23 }, + new() \{ Name = "Carol", Age = 31 }, +} + +// Person[] -> CSV (UTF-8) +byte[] csv = CsvSerializer.Serialize(array); + +// Person[] -> CSV (UTF-16) +string csvText = CsvSerializer.SerializeToString(array); + +// CSV (UTF-8) -> Person[] +array = CsvSerializer.Deserialize(csv); + +// CSV (UTF-16) -> Person[] +array = CsvSerializer.Deserialize(csvText); +``` + +Serialize has an overload that returns a UTF-8 encoded `byte[]`, and you can also pass a `Stream` or `IBufferWriter` for writing. Deserialize accepts UTF-8 byte arrays as `byte[]` and also supports `string`, `Stream`, and `ReadOnlySequence`. + +The default supported types for fields are `sbyte`, `byte`, `short`, `ushort`, `int`, `uint`, `long`, `ulong`, `char`, `string`, `Enum`, `Nullable`, `DateTime`, `TimeSpan`, and `Guid`. To support other types, refer to the Extensions section. + +## Serialization + +The class/struct passed to `CsvSerializer` should have the `[CsvObject]` attribute and the `partial` keyword. + +By default, fields and properties with the `[Column]` attribute are the targets for serialization/deserialization. The `[Column]` attribute is mandatory for public members, but you can target private members by adding the `[Column]` attribute. + +```cs +[CsvObject] +public partial class Person +{ + [Column(0)] + public string Name \{ get; set; } + + [Column(1)] + int age; + + [IgnoreMember] + public int Age => age; +} +``` + +To specify header names instead of indices, use a string key. + +```cs +[CsvObject] +public partial class Person +{ + [Column("name")] + public string Name \{ get; set; } + + [Column("age")] + public int Age \{ get; set; } +} +``` + +To use member names as keys, specify `[CsvObject(keyAsPropertyName: true)]`. In this case, the `[Column]` attribute is not required. + +```cs +[CsvObject(keyAsPropertyName: true)] +public partial class Person +{ + public string Name \{ get; set; } + public int Age \{ get; set; } +} +``` + +## CsvDocument + +If you need to directly parse CSV fields, you can use `CsvDocument`. + +```cs +var array = new Person[] +{ + new() \{ Name = "Alice", Age = 18 }, + new() \{ Name = "Bob", Age = 23 }, + new() \{ Name = "Carol", Age = 31 }, +}; + +byte[] csv = CsvSerializer.Serialize(array); + +// CSV (UTF-8) -> CsvDocument +var document = CsvSerializer.ConvertToDocument(csv); + +foreach (var row in document.Rows) +{ + var name = row["Name"].GetValue(); + var age = row["Age"].GetValue(); +} +``` + +## Options + +You can change CSV settings by passing `CsvOptions` to Serialize/Deserialize. + +```cs +CsvSerializer.Serialize(array, new CsvOptions() +{ + HasHeader = true, // Include header row + AllowComments = true, // Allow comments starting with '#'' + NewLine = NewLineType.LF, // Newline type + Separator = SeparatorType.Comma, // Separator character + QuoteMode = QuoteMode.Minimal, // Conditions for quoting fields (Minimal quotes only strings containing escape characters) + FormatterProvider = StandardFormatterProvider.Instance, // ICsvFormatterProvider to use +}); +``` + +## CSV Specifications + +The default settings of Csv-CSharp generally follow the specifications outlined in [RFC 4180](https://www.rfc-editor.org/rfc/rfc4180.html). However, please note that for performance and practicality reasons, some specifications may be disregarded. + +- The default newline character is LF instead of CRLF. +- Records with a mismatch in the number of fields can be read without errors being output; missing fields will be set to their default values. + +## Extensions + +Interfaces `ICsvFormatter` and `ICsvFormatterProvider` are provided to customize field serialization/deserialization. + +Use `ICsvFormatter` for type serialization/deserialization. Here is an example of implementing a formatter for a struct wrapping an `int`. + +```cs +public struct Foo +{ + public int Value; + + public Foo(int value) + { + this.Value = value; + } +} + +public sealed class FooFormatter : ICsvFormatter +{ + public Foo Deserialize(ref CsvReader reader) + { + var value = reader.ReadInt32(); + return new Foo(value); + } + + public void Serialize(ref CsvWriter writer, Foo value) + { + writer.WriteInt32(value.Value); + } +} +``` + +Next, implement a formatter provider to retrieve the formatter. + +```cs +public class CustomFormatterProvider : ICsvFormatterProvider +{ + public static readonly ICsvFormatterProvider Instance = new CustomFormatterProvider(); + + CustomFormatterProvider() + { + } + + static CustomFormatterProvider() + { + FormatterCache.Formatter = new FooFormatter(); + } + + public ICsvFormatter? GetFormatter() + { + return FormatterCache.Formatter; + } + + static class FormatterCache + { + public static readonly ICsvFormatter Formatter; + } +} +``` + +You can set the created formatter provider in CsvOptions. The above `CustomFormatterProvider` only supports the `Foo` struct, so combine it with the standard formatter provider `StandardFormatterProvider`. + +```cs +// Create a composite formatter provider combining multiple formatter providers +var provider = CompositeFormatterProvider.Create( + CustomFormatterProvider.Instance, + StandardFormatterProvider.Instance +); + +CsvSerializer.Serialize(array, new CsvOptions() +{ + FormatterProvider = provider +}); +``` + +## License + +This library is released under the MIT license. + +::: + +### About +:::note + +Serializer for CSV files + + +::: + +## How to use + +### Example (source csproj, source files) + + + + + +This is the CSharp Project that references **Csvcsharp** +```xml showLineNumbers {14} + + + + Exe + net9.0 + enable + enable + + + true + $(BaseIntermediateOutputPath)\GX + + + + + + + +``` + + + + + + This is the use of **Csvcsharp** in *Program.cs* + +```csharp showLineNumbers +using Csv; +using SerializerDemo; + +var p= new Person() \{ Name= "Andrei Ignat" , Age=55}; +var utf8Csv = CsvSerializer.SerializeToString([p]); +Console.WriteLine(utf8Csv); +var p1 = CsvSerializer.Serialize([p]); +var p2 = CsvSerializer.Deserialize(p1); + +Console.WriteLine(p2.First().Name); +Console.WriteLine(p2.First().Age); +``` + + + + + This is the use of **Csvcsharp** in *Person.cs* + +```csharp showLineNumbers +using Csv.Annotations; + +namespace SerializerDemo; +[CsvObject] +public partial class Person +{ + [Column(0)] + public int Age \{ get; set; } + [Column(1)] + public string Name \{ get; set; \} = string.Empty; + +} + + +``` + + + + +### Generated Files + +Those are taken from $(BaseIntermediateOutputPath)\GX + + + + +```csharp showLineNumbers + // + #nullable enable + #pragma warning disable CS0162 // Unreachable code + #pragma warning disable CS0219 // Variable assigned but never used + #pragma warning disable CS8600 // Converting null literal or possible null value to non-nullable type. + #pragma warning disable CS8601 // Possible null reference assignment + #pragma warning disable CS8602 // Possible null return + #pragma warning disable CS8604 // Possible null reference argument for parameter + #pragma warning disable CS8631 // The type cannot be used as type parameter in the generic type or method + + using System; + using Csv; + using Csv.Annotations; + using Csv.Internal; + + namespace SerializerDemo + { + partial class Person : global::Csv.ICsvSerializerRegister + { + static void RegisterCsvSerializer() + { + global::Csv.CsvSerializer.Register(GeneratedCsvSerializer.Instance); + } + class GeneratedCsvSerializer : ICsvSerializer + { + public static readonly GeneratedCsvSerializer Instance = new(); + static readonly byte[] AgeUtf8Key = \{ 65, 103, 101 }; // Age + static readonly byte[] NameUtf8Key = \{ 78, 97, 109, 101 }; // Name + + public void Serialize(ref global::Csv.CsvWriter writer, global::System.ReadOnlySpan values) + { + if (writer.Options.HasHeader) + { + var quoteHeader = writer.Options.QuoteMode is (global::Csv.QuoteMode.All or global::Csv.QuoteMode.NonNumeric); + if (quoteHeader) writer.WriteRaw((byte)'"'); + writer.WriteRaw(AgeUtf8Key.AsSpan()); + if (quoteHeader) writer.WriteRaw((byte)'"'); + writer.WriteSeparator(); + if (quoteHeader) writer.WriteRaw((byte)'"'); + writer.WriteRaw(NameUtf8Key.AsSpan()); + if (quoteHeader) writer.WriteRaw((byte)'"'); + writer.WriteEndOfLine(); + } + for (int i = 0; i < values.Length; i++) + { + var item = values[i]; + writer.WriteInt32(item.Age); + writer.WriteSeparator(); + writer.WriteString(item.Name); + if (i != values.Length - 1) writer.WriteEndOfLine(); + } + } + + public void Serialize(ref global::Csv.CsvWriter writer, global::System.Collections.Generic.IEnumerable values) + { + if (writer.Options.HasHeader) + { + var quoteHeader = writer.Options.QuoteMode is (global::Csv.QuoteMode.All or global::Csv.QuoteMode.NonNumeric); + if (quoteHeader) writer.WriteRaw((byte)'"'); + writer.WriteRaw(AgeUtf8Key.AsSpan()); + if (quoteHeader) writer.WriteRaw((byte)'"'); + writer.WriteSeparator(); + if (quoteHeader) writer.WriteRaw((byte)'"'); + writer.WriteRaw(NameUtf8Key.AsSpan()); + if (quoteHeader) writer.WriteRaw((byte)'"'); + writer.WriteEndOfLine(); + } + var e = values.GetEnumerator(); + try + { + if (!e.MoveNext()) return; + while (true) + { + var item = e.Current; + writer.WriteInt32(item.Age); + writer.WriteSeparator(); + writer.WriteString(item.Name); + if (!e.MoveNext()) + { + writer.WriteEndOfLine(); + break; + } + } + } + finally + { + e.Dispose(); + } + } + + public global::SerializerDemo.Person[] Deserialize(ref global::Csv.CsvReader reader) + { + var allowComments = reader.Options.AllowComments; + while (reader.TryReadEndOfLine(true) || (allowComments && reader.TrySkipComment(false))) \{ } + if (reader.Options.HasHeader) reader.SkipLine(); + using var list = new TempList(); + while (reader.Remaining > 0) + { + if (reader.TryReadEndOfLine()) continue; + if (allowComments && reader.TrySkipComment(false)) continue; + var __Age = default(int); + var __Name = default(string); + var ___endOfLine = false; + for (int __i = 0; __i <= 1; __i++) + { + switch (__i) + { + case 0: + __Age = reader.ReadInt32(); + break; + case 1: + __Name = reader.ReadString(); + break; + default: + reader.SkipField(); + break; + } + if (reader.TryReadEndOfLine(true)) + { + ___endOfLine = true; + goto ADD_ITEM; + } + if (!reader.TryReadSeparator(false)) goto ADD_ITEM; + } + + ADD_ITEM: + list.Add( new() + { + Age = __Age, + Name = __Name, + } + ); + + if (!___endOfLine) reader.SkipLine(); + } + return list.AsSpan().ToArray(); + } + + public int Deserialize(ref global::Csv.CsvReader reader, global::System.Span destination) + { + var allowComments = reader.Options.AllowComments; + while (reader.TryReadEndOfLine(true) || (allowComments && reader.TrySkipComment(false))) \{ } + if (reader.Options.HasHeader) reader.SkipLine(); + var n = 0; + while (reader.Remaining > 0) + { + if (reader.TryReadEndOfLine()) continue; + if (allowComments && reader.TrySkipComment(false)) continue; + var __Age = default(int); + var __Name = default(string); + var ___endOfLine = false; + for (int __i = 0; __i <= 1; __i++) + { + switch (__i) + { + case 0: + __Age = reader.ReadInt32(); + break; + case 1: + __Name = reader.ReadString(); + break; + default: + reader.SkipField(); + break; + } + if (reader.TryReadEndOfLine(true)) + { + ___endOfLine = true; + goto ADD_ITEM; + } + if (!reader.TryReadSeparator(false)) goto ADD_ITEM; + } + + ADD_ITEM: + destination[n++] = new() + { + Age = __Age, + Name = __Name, + } + ; + + if (!___endOfLine) reader.SkipLine(); + } + return n; + } + } + } + #pragma warning restore CS0162 // Unreachable code + #pragma warning restore CS0219 // Variable assigned but never used + #pragma warning restore CS8600 // Converting null literal or possible null value to non-nullable type. + #pragma warning restore CS8601 // Possible null reference assignment + #pragma warning restore CS8602 // Possible null return + #pragma warning restore CS8604 // Possible null reference argument for parameter + #pragma warning restore CS8631 // The type cannot be used as type parameter in the generic type or method + } + +``` + + + + +```csharp showLineNumbers + // + #nullable enable + #pragma warning disable CS0162 // Unreachable code + #pragma warning disable CS0219 // Variable assigned but never used + #pragma warning disable CS8600 // Converting null literal or possible null value to non-nullable type. + #pragma warning disable CS8601 // Possible null reference assignment + #pragma warning disable CS8602 // Possible null return + #pragma warning disable CS8604 // Possible null reference argument for parameter + #pragma warning disable CS8619 // Possible null reference assignment fix + #pragma warning disable CS8631 // The type cannot be used as type parameter in the generic type or method + + using System; + using VYaml.Annotations; + using VYaml.Parser; + using VYaml.Emitter; + using VYaml.Serialization; + + namespace SerializerDemo + { + partial class Person + { + [VYaml.Annotations.Preserve] + public static void __RegisterVYamlFormatter() + { + global::VYaml.Serialization.GeneratedResolver.Register(new PersonGeneratedFormatter()); + } + [VYaml.Annotations.Preserve] + public class PersonGeneratedFormatter : IYamlFormatter + { + static readonly byte[] AgeKeyUtf8Bytes = \{ 97, 103, 101 }; // age + + static readonly byte[] NameKeyUtf8Bytes = \{ 110, 97, 109, 101 }; // name + + [VYaml.Annotations.Preserve] + public void Serialize(ref Utf8YamlEmitter emitter, global::SerializerDemo.Person? value, YamlSerializationContext context) + { + if (value is null) + { + emitter.WriteNull(); + return; + } + emitter.BeginMapping(); + if (context.Options.NamingConvention == global::VYaml.Annotations.NamingConvention.LowerCamelCase) + { + emitter.WriteScalar(AgeKeyUtf8Bytes); + } + else + { + global::VYaml.Serialization.NamingConventionMutator.MutateToThreadStaticBufferUtf8(AgeKeyUtf8Bytes, context.Options.NamingConvention, out var mutated, out var written); + emitter.WriteScalar(mutated.AsSpan(0, written)); + } + context.Serialize(ref emitter, value.Age); + if (context.Options.NamingConvention == global::VYaml.Annotations.NamingConvention.LowerCamelCase) + { + emitter.WriteScalar(NameKeyUtf8Bytes); + } + else + { + global::VYaml.Serialization.NamingConventionMutator.MutateToThreadStaticBufferUtf8(NameKeyUtf8Bytes, context.Options.NamingConvention, out var mutated, out var written); + emitter.WriteScalar(mutated.AsSpan(0, written)); + } + context.Serialize(ref emitter, value.Name); + emitter.EndMapping(); + } + [VYaml.Annotations.Preserve] + public global::SerializerDemo.Person? Deserialize(ref YamlParser parser, YamlDeserializationContext context) + { + if (parser.IsNullScalar()) + { + parser.Read(); + return default; + } + parser.ReadWithVerify(ParseEventType.MappingStart); + + var __Age__ = default(int); + var __Name__ = default(string); + while (!parser.End && parser.CurrentEventType != ParseEventType.MappingEnd) + { + if (parser.CurrentEventType != ParseEventType.Scalar) + { + throw new YamlSerializerException(parser.CurrentMark, "Custom type deserialization supports only string key"); + } + + if (!parser.TryGetScalarAsSpan(out var key)) + { + throw new YamlSerializerException(parser.CurrentMark, "Custom type deserialization supports only string key"); + } + + if (context.Options.NamingConvention != global::VYaml.Annotations.NamingConvention.LowerCamelCase) + { + global::VYaml.Serialization.NamingConventionMutator.MutateToThreadStaticBufferUtf8(key, global::VYaml.Annotations.NamingConvention.LowerCamelCase, out var mutated, out var written); + key = mutated.AsSpan(0, written); + } + switch (key.Length) + { + case 3: + if (key.SequenceEqual(AgeKeyUtf8Bytes)) + { + parser.Read(); // skip key + __Age__ = context.DeserializeWithAlias(ref parser); + continue; + } + goto default; + case 4: + if (key.SequenceEqual(NameKeyUtf8Bytes)) + { + parser.Read(); // skip key + __Name__ = context.DeserializeWithAlias(ref parser); + continue; + } + goto default; + default: + parser.Read(); // skip key + parser.SkipCurrentNode(); // skip value + continue; + } + } + parser.ReadWithVerify(ParseEventType.MappingEnd); + return new Person + { + Age = __Age__, + Name = __Name__, + } + ; + } + } + } + } + #pragma warning restore CS0162 // Unreachable code + #pragma warning restore CS0219 // Variable assigned but never used + #pragma warning restore CS8600 // Converting null literal or possible null value to non-nullable type. + #pragma warning restore CS8601 // Possible null reference assignment + #pragma warning restore CS8602 // Possible null return + #pragma warning restore CS8604 // Possible null reference argument for parameter + #pragma warning restore CS8631 // The type cannot be used as type parameter in the generic type or method + +``` + + + + +## Useful + +### Download Example (.NET C#) + +:::tip + +[Download Example project Csvcsharp ](/sources/Csvcsharp.zip) + +::: + + +### Share Csvcsharp + + + +https://ignatandrei.github.io/RSCG_Examples/v2/docs/Csvcsharp + + + diff --git a/v2/rscg_examples_site/docs/RSCG-Examples/index.md b/v2/rscg_examples_site/docs/RSCG-Examples/index.md index 53619a0c9..ad2708268 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: 234 RSCG list by category -description: 234 RSCG list by category +title: 235 RSCG list by category +description: 235 RSCG list by category slug: /rscg-examples --- @@ -1259,7 +1259,7 @@ import DocCardList from '@theme/DocCardList'; ## Serializer
- Expand Serializer =>examples:9 + Expand Serializer =>examples:10 @@ -1305,6 +1305,11 @@ import DocCardList from '@theme/DocCardList'; [VYaml](/docs/VYaml) + + + +[Csvcsharp](/docs/Csvcsharp) +
@@ -1882,6 +1887,8 @@ flowchart LR; Serializer--> VYaml((VYaml)) + Serializer--> Csvcsharp((Csvcsharp)) + SignalR--> TypedSignalR.Client((TypedSignalR.Client)) StateMachine--> SuperFluid((SuperFluid)) diff --git a/v2/rscg_examples_site/docs/about.md b/v2/rscg_examples_site/docs/about.md index 382c89954..f64303ec6 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 234 Roslyn Source Code Generator (RSCG) +of 235 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 dbac49ba9..06128c371 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'; -## 234 RSCG with examples in descending chronological order +## 235 RSCG with examples in descending chronological order -This is the list of 234 ( 14 from Microsoft) RSCG with examples +This is the list of 235 ( 14 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 234 ( 14 from Microsoft) RSCG with examples | No | Name | Date | Category | | --------- | ----- | ---- | -------- | +|235| [Csvcsharp by Yusuke Nakada ](/docs/Csvcsharp)|2025-10-05 => 05 October 2025 | [Serializer](/docs/Categories/Serializer) | |234| [RapidEnum by hanachiru ](/docs/RapidEnum)|2025-10-04 => 04 October 2025 | [Enum](/docs/Categories/Enum) | |233| [VYaml by Hadashi A ](/docs/VYaml)|2025-10-03 => 03 October 2025 | [Serializer](/docs/Categories/Serializer) | |232| [ConsoleAppFramework by Cysharp, Inc. ](/docs/ConsoleAppFramework)|2025-10-02 => 02 October 2025 | [Console](/docs/Categories/Console) | diff --git a/v2/rscg_examples_site/src/components/HomepageFeatures/index.js b/v2/rscg_examples_site/src/components/HomepageFeatures/index.js index 3ad6c7bc0..1cd427ea5 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: '234 Examples (14 from MSFT)', +title: '235 Examples (14 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 93f1d178c..1ca221e5c 100644 --- a/v2/rscg_examples_site/static/exports/RSCG.json +++ b/v2/rscg_examples_site/static/exports/RSCG.json @@ -1873,6 +1873,14 @@ "Source": "https://github.com/hanachiru/RapidEnum", "Category": "Enum", "AddedOn": "2025-10-04T00:00:00" + }, + { + "Name": "Csvcsharp", + "Link": "https://ignatandrei.github.io/RSCG_Examples/v2/docs/CsvCsharp", + "NuGet": "https://www.nuget.org/packages/Csvcsharp/", + "Source": "https://github.com/nuskey8/Csv-CSharp", + "Category": "Serializer", + "AddedOn": "2025-10-05T00: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 d0508fba6..65f8ba196 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/Csvcsharp.zip b/v2/rscg_examples_site/static/sources/Csvcsharp.zip new file mode 100644 index 000000000..bbdbc0812 Binary files /dev/null and b/v2/rscg_examples_site/static/sources/Csvcsharp.zip differ