{"id":13629569,"url":"https://github.com/piotrstenke/Durian","last_synced_at":"2025-04-17T09:34:56.277Z","repository":{"id":41541520,"uuid":"358701265","full_name":"piotrstenke/Durian","owner":"piotrstenke","description":"Durian is a collection of Roslyn-based analyzers and source generators that extend the default capabilities of C#.","archived":false,"fork":false,"pushed_at":"2022-09-19T07:32:37.000Z","size":4261,"stargazers_count":54,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-08-01T22:43:55.429Z","etag":null,"topics":["analysis","csharp","roslyn","roslyn-analyzer","source-generation"],"latest_commit_sha":null,"homepage":"","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/piotrstenke.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-04-16T19:34:18.000Z","updated_at":"2024-07-30T04:29:34.000Z","dependencies_parsed_at":"2022-08-26T06:41:59.461Z","dependency_job_id":null,"html_url":"https://github.com/piotrstenke/Durian","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piotrstenke%2FDurian","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piotrstenke%2FDurian/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piotrstenke%2FDurian/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piotrstenke%2FDurian/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/piotrstenke","download_url":"https://codeload.github.com/piotrstenke/Durian/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223751246,"owners_count":17196593,"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":["analysis","csharp","roslyn","roslyn-analyzer","source-generation"],"created_at":"2024-08-01T22:01:13.804Z","updated_at":"2025-04-17T09:34:56.269Z","avatar_url":"https://github.com/piotrstenke.png","language":"C#","funding_links":[],"categories":["C\\#","Source Generators","Do not want to test 112 ( old ISourceGenerator )"],"sub_categories":["Other","1. [ThisAssembly](https://ignatandrei.github.io/RSCG_Examples/v2/docs/ThisAssembly) , in the [EnhancementProject](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#enhancementproject) category"],"readme":"﻿\u003cdiv align=\"left\"\u003e\n\t\u003ca href=\"https://www.nuget.org/packages/Durian\"\u003e\n\t\t\u003cimg src=\"https://img.shields.io/nuget/v/Durian?color=seagreen\u0026style=flat-square\" alt=\"Version\"/\u003e\n\t\u003c/a\u003e\n\t\u003ca href=\"https://www.nuget.org/packages/Durian\"\u003e\n\t\t\u003cimg src=\"https://img.shields.io/nuget/dt/Durian?color=blue\u0026style=flat-square\" alt=\"Downloads\"/\u003e\n\t\u003c/a\u003e \u003cbr /\u003e\n\t\u003ca href=\"https://github.com/piotrstenke/Durian/actions\"\u003e\n\t\t\u003cimg src=\"https://img.shields.io/github/actions/workflow/status/piotrstenke/Durian/dotnet.yml\" alt=\"Build\"/\u003e\n\t\u003c/a\u003e\n\t\u003ca href=\"https://github.com//piotrstenke/Durian/blob/master/LICENSE.md\"\u003e\n\t\t\u003cimg src=\"https://img.shields.io/github/license/piotrstenke/Durian?color=orange\u0026style=flat-square\" alt=\"License\"/\u003e\n\t\u003c/a\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n\t\t\u003cimg src=\"img/icons/Durian-256.png\" alt=\"Durian logo\"/\u003e\n\u003c/div\u003e\n\n##\n\n**Durian is a collection of Roslyn-based analyzers, source generators and utility libraries that greatly extend the default capabilities of C# by bringing new features found in other existing programing languages, such as Kotlin, Swift, Java, C++, and many more.**\n\n## Table of Contents\n\n1. [Current State](#current-state)\n2. [Features](#features)\n\t1. [DefaultParam](#defaultparam)\n\t2. [InterfaceTargets](#interfacetargets)\n\t3. [FriendClass](#friendclass)\n\t4. [CopyFrom](#copyfrom)\n3. [In Progress](#in-progress)\n4. [Experimental](#experimental) \n\n## Current State\n\nDurian is still very much in development - many planned features are still not implemented or implemented only partially. Features that are production-ready are listed in the [Features](#Features) section below.\n\n## Features\n\nIf you seek more information about a specific feature, click on its name below.\n\n### [DefaultParam](src/Durian.DefaultParam/README.md)\n*DefaultParam* allows to specify a default type for a generic parameter.\n\n```csharp\nusing Durian;\n\npublic class Test\u003c[DefaultParam(typeof(string))]T\u003e\n{\n\tpublic T Value { get; }\n\n\tpublic Test(T value)\n\t{\n\t\tValue = value;\n\t}\n}\n\npublic class Program\n{\n\tstatic void Main()\n\t{\n\t\t// Test\u003cT\u003e can be used without type parameters - 'T' defaults to 'string'.\n\t\tTest test1 = new Test(\"\");\n\t\t\n\t\t// Type parameter can be stated explicitly.\n\t\tTest\u003cstring\u003e test2 = new Test\u003cstring\u003e(\"\");\n\t}\n}\n\n```\n\n### [InterfaceTargets](src/Durian.InterfaceTargets/README.md)\n\n*InterfaceTargets*, similar to how [System.AttributeUsageAttribute](https://docs.microsoft.com/en-us/dotnet/api/system.attributeusageattribute) works, allows to specify what kinds of types an interface can be implemented by.\n\n```csharp\nusing Durian;\n\n[InterfaceTargets(InterfaceTargets.Class)]\npublic interface ITest\n{\n}\n\n// Success!\n// ITest can be implemented, because ClassTest is a class.\npublic class ClassTest : ITest\n{\n}\n\n// Error!\n// ITest cannot be implemented, because StructTest is a struct, and ITest is valid only for classes.\npublic struct StructTest : ITest\n{\n}\n\n```\n\n### [FriendClass](src/Durian.FriendClass/README.md)\n\n*FriendClass* allows to limit access to 'internal' members by specifying a fixed list of friend types.\n\n```csharp\nusing Durian;\n\n[FriendClass(typeof(A))]\npublic class Test\n{\n\tinternal static string Key { get; }\n}\n\npublic class A\n{\n\tpublic string GetKey()\n\t{\n\t\t// Success!\n\t\t// Type 'A' is a friend of 'Test', so it can safely access internal members.\n\t\treturn Test.Key;\n\t}\n}\n\npublic class B\n{\n\tpublic string GetKey()\n\t{\n\t\t// Error!\n\t\t// Type 'B' is not a friend of 'Test', so it cannot access internal members.\n\t\treturn Test.Key;\n\t}\n}\n```\n\n### [CopyFrom](src/Durian.CopyFrom/README.md)\n\n*CopyFrom* allows to copy implementations of members to other members, without the need for inheritance. A regex pattern can be provided to customize the copied implementation.\n\n```csharp\nusing Durian;\n\n[CopyFromType(typeof(Other)), Pattern(\"text\", \"name\")]\npublic partial class Test\n{\n}\n\npublic class Other\n{\n\tprivate string _text;\n\n\tvoid Set(string text)\n\t{\n\t\t_text = text;\n\t}\n}\n\n// Generated\n\npartial class Test\n{\n\tprivate string _name;\n\n\tvoid Set(string name)\n\t{\n\t\t_name = name;\n\t}\n}\n\n```\n\n## In Progress\n\nThe following modules are still in active development and are yet to be released in a not-yet-specified future.\n\n## Experimental\n\nExperimental stage is a playground of sorts - modules included here are very early in development and there in no guarantee that they will be ever actually released.\n\n##\n\n*\\(Written by Piotr Stenke\\)*\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiotrstenke%2FDurian","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpiotrstenke%2FDurian","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiotrstenke%2FDurian/lists"}