{"id":23170986,"url":"https://github.com/ignatandrei/rscg_utils","last_synced_at":"2026-03-11T14:03:05.514Z","repository":{"id":159675081,"uuid":"634732242","full_name":"ignatandrei/RSCG_Utils","owner":"ignatandrei","description":"Roslyn Source Code Generators Utils","archived":false,"fork":false,"pushed_at":"2024-07-09T21:54:16.000Z","size":81,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-15T06:46:37.590Z","etag":null,"topics":["dotnet","roslyn-generator","rscg"],"latest_commit_sha":null,"homepage":"https://www.nuget.org/packages/rscgutils","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ignatandrei.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-01T03:20:00.000Z","updated_at":"2023-08-25T14:34:15.000Z","dependencies_parsed_at":"2024-03-15T13:34:08.794Z","dependency_job_id":"17a642cc-fa5b-43ac-acdc-ae566d4f5267","html_url":"https://github.com/ignatandrei/RSCG_Utils","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ignatandrei%2FRSCG_Utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ignatandrei%2FRSCG_Utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ignatandrei%2FRSCG_Utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ignatandrei%2FRSCG_Utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ignatandrei","download_url":"https://codeload.github.com/ignatandrei/RSCG_Utils/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241921840,"owners_count":20042763,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dotnet","roslyn-generator","rscg"],"created_at":"2024-12-18T04:15:48.082Z","updated_at":"2026-03-11T14:03:05.456Z","avatar_url":"https://github.com/ignatandrei.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RSCG_Utils\n\nRoslyn Source Code Generators Utils\n\n[![pack to nuget](https://github.com/ignatandrei/RSCG_Utils/actions/workflows/dotnet.yml/badge.svg)](https://github.com/ignatandrei/RSCG_Utils/actions/workflows/dotnet.yml)\n\n[![pack to nuget](https://img.shields.io/nuget/dt/rscgutils?style=for-the-badge)](https://www.nuget.org/packages/rscgutils)\n\n# Usage\n\n## Additional Files\n\nAllow you to see additional files directly as C# const. For this, please add some .gen. files to the project.\n\nIn your csproj\n\n```xml\n\u003cItemGroup\u003e\n \t  \u003cPackageReference Include=\"rscgutils\" Version=\"2024.2000.2000\" OutputItemType=\"Analyzer\" ReferenceOutputAssembly=\"false\" /\u003e\n\u003c/ItemGroup\u003e\n\u003cItemGroup\u003e\n\t\u003cAdditionalFiles Include=\"Second.gen.txt\" /\u003e\n\t\u003cAdditionalFiles Include=\"first.gen.txt\" /\u003e\n\t\u003cAdditionalFiles Include=\"test\\Afirst.gen.txt\" /\u003e\n\t\u003cAdditionalFiles Include=\"sql/**/*\" /\u003e\n\u003c/ItemGroup\u003e\n```\n\nIn the code\n\n```csharp\n//see https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/tokens/raw-string\nstring x= MyAdditionalFiles.Second_gen_txt;\n```\n\nTo debug, you can add into the .csproj\n```xml\n\u003cPropertyGroup\u003e\n\t\u003cEmitCompilerGeneratedFiles\u003etrue\u003c/EmitCompilerGeneratedFiles\u003e\n\t\u003cCompilerGeneratedFilesOutputPath\u003e$(BaseIntermediateOutputPath)\\GeneratedX\u003c/CompilerGeneratedFilesOutputPath\u003e\n\u003c/PropertyGroup\u003e\n```\n\nMore details at http://msprogrammer.serviciipeweb.ro/2023/05/08/file-to-csharp-const/\n\n\n## Json2Class\n\nIf you have an additional json file, you can have a file from this\n\n```xml\n\u003cItemGroup\u003e\n\t\u003cAdditionalFiles Include=\"my.gen.json\" /\u003e\n\u003c/ItemGroup\u003e\n```\n\nAnd you can have from the code\n```csharp\n\nvar json = System.Text.Json.JsonSerializer\n    .Deserialize\u003cGeneratedJson.my_gen_json\u003e(MyAdditionalFiles.my_gen_json);\n\nArgumentNullException.ThrowIfNull( json );\nConsole.WriteLine( \":hosts\"+json.AllowedHosts );\n\n```\n\n## Memoization of function returns\n\nPut _MemoPure and the return of the function will be memo-ized\n\n```csharp\npublic long Test_MemoPure()\n{\n    Console.WriteLine(\"calculating type\");\n    return this.GetType().ToString().GetHashCode();\n}\npublic async Task\u003clong\u003e fib(long nr)\n{\n    await Task.Delay(1000);\n    //Console.WriteLine(\"calculated value for \" + nr);\n    if (nr \u003c= 1) return 1;\n    if (nr == 2) return 2;\n    return await fib(nr - 1) + await fib(nr - 1);\n}\n\npublic async Task\u003clong\u003e fibonacci_MemoPure(long nr)\n{\n    if (nr \u003c= 1) return 1;\n    if (nr == 2) return 2;\n    await Task.Delay(1000);\n    return await fibonacci(nr - 1) + await fibonacci(nr - 1);\n\n}\n```\n\nAnd call\n\n```csharp\nfibTest f = new();\nConsole.WriteLine(\"first time :\" + f.Test());\nConsole.WriteLine(\"second time :\" + f.Test());\n\nConsole.WriteLine(DateTime.Now.ToString(\"mm_ss\"));\nConsole.WriteLine(\"no memo :\"+await f.fib(5));\nConsole.WriteLine(DateTime.Now.ToString(\"mm_ss\"));\nConsole.WriteLine(\"memo :\" + await f.fibonacci(5));\nConsole.WriteLine(DateTime.Now.ToString(\"mm_ss\"));\nConsole.WriteLine(\"FAST memo :\" + await f.fibonacci(5));\nConsole.WriteLine(DateTime.Now.ToString(\"mm_ss\"));\n\n\n```\n\n# More Roslyn Source Code Generators\n\nYou can find more RSCG with examples at [Roslyn Source Code Generators](https://ignatandrei.github.io/RSCG_Examples/v2/)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fignatandrei%2Frscg_utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fignatandrei%2Frscg_utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fignatandrei%2Frscg_utils/lists"}