{"id":15035837,"url":"https://github.com/replaysmike/typesupport","last_synced_at":"2026-02-27T22:42:32.044Z","repository":{"id":60773147,"uuid":"158595138","full_name":"replaysMike/TypeSupport","owner":"replaysMike","description":"A CSharp library that makes it easier to work with Types dynamically.","archived":false,"fork":false,"pushed_at":"2023-03-14T21:48:51.000Z","size":206,"stargazers_count":23,"open_issues_count":1,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-09T23:15:14.312Z","etag":null,"topics":["constructorless-factory","csharp","csharp-code","helper","helpers-library","object-factory","reflection","type-utilities","types","typesupport"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/replaysMike.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":"2018-11-21T19:12:41.000Z","updated_at":"2024-12-06T22:43:22.000Z","dependencies_parsed_at":"2024-10-12T14:20:35.412Z","dependency_job_id":null,"html_url":"https://github.com/replaysMike/TypeSupport","commit_stats":{"total_commits":102,"total_committers":4,"mean_commits":25.5,"dds":"0.16666666666666663","last_synced_commit":"54bf3051ed6ad679b8e71b424605111ef2445703"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/replaysMike%2FTypeSupport","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/replaysMike%2FTypeSupport/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/replaysMike%2FTypeSupport/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/replaysMike%2FTypeSupport/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/replaysMike","download_url":"https://codeload.github.com/replaysMike/TypeSupport/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248125591,"owners_count":21051770,"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":["constructorless-factory","csharp","csharp-code","helper","helpers-library","object-factory","reflection","type-utilities","types","typesupport"],"created_at":"2024-09-24T20:29:35.687Z","updated_at":"2026-02-27T22:42:31.994Z","avatar_url":"https://github.com/replaysMike.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TypeSupport\n[![nuget](https://img.shields.io/nuget/v/TypeSupport.svg)](https://www.nuget.org/packages/TypeSupport/)\n[![nuget](https://img.shields.io/nuget/dt/TypeSupport.svg)](https://www.nuget.org/packages/TypeSupport/)\n[![Build status](https://ci.appveyor.com/api/projects/status/swv5vcad12nrwohk?svg=true)](https://ci.appveyor.com/project/MichaelBrown/typesupport)\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/5ddab4815a2a49b3babac9af232f9f04)](https://www.codacy.com/app/replaysMike/TypeSupport?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=replaysMike/TypeSupport\u0026amp;utm_campaign=Badge_Grade)\n[![Codacy Badge](https://api.codacy.com/project/badge/Coverage/5ddab4815a2a49b3babac9af232f9f04)](https://www.codacy.com/app/replaysMike/TypeSupport?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=replaysMike/TypeSupport\u0026utm_campaign=Badge_Coverage)\n\nA CSharp library that makes it easier to work with Types dynamically. TypeSupport includes a flexible Object factory for creating and initializing all kinds of types.\n\n## Description\n\nThe best way to understand what TypeSupport can do is to see it in action! It is used as the foundation for many other packages.\n\n## Installation\nInstall TypeSupport from the Package Manager Console:\n```PowerShell\nPM\u003e Install-Package TypeSupport\n```\n\n## Usage\n\n### Type Support\n\nGetting started - create a TypeSupport from a type\n```csharp\nusing TypeSupport;\n\nvar type = typeof(MyObject);\nvar typeSupport = new ExtendedType(type);\n```\n\nor do it using the extensions (we will use this syntax going forward):\n```csharp\nusing TypeSupport;\n\nvar type = typeof(MyObject);\nvar typeSupport = type.GetExtendedType();\n```\n\nget information about an array:\n```csharp\nvar type = typeof(int[]);\nvar typeSupport = type.GetExtendedType();\n\nvar isArray = typeSupport.IsArray; // true\nvar elementType = typeSupport.ElementType; // int\n```\n\nget information about a Dictionary:\n```csharp\nvar type = typeof(Dictionary\u003cint, string\u003e);\nvar typeSupport = type.GetExtendedType();\n\nvar isArray = typeSupport.IsDictionary; // true\nvar elementTypes = typeSupport.GenericArgumentTypes; // System.Int32, System.String\n```\n\nget info about an interface:\n```csharp\nvar type = typeof(IVehicle);\nvar typeSupport = type.GetExtendedType();\n\nvar isArray = typeSupport.IsInterface; // true\nvar classesThatImplementICustomInterface = typeSupport.KnownConcreteTypes;\n// [] = Car, Truck, Van, Motorcycle\n```\n\nget info about a class:\n```csharp\n[Description(\"A car object\")]\npublic class Car : IVehicle\n{\n  public string Name { get; set; }\n  public Car() { }\n}\nvar type = typeof(Car);\nvar typeSupport = type.GetExtendedType();\n\nvar isArray = typeSupport.HasEmptyConstructor; // true\nvar attributes = typeSupport.Attributes;\n// [] = DescriptionAttribute\n```\n\nworking with enums:\n```csharp\npublic enum Colors : byte\n{\n  Red = 1,\n  Green = 2,\n  Blue = 3\n}\nvar type = typeof(Colors);\nvar typeSupport = type.GetExtendedType();\n\nvar isEnum = typeSupport.IsEnum; // true\nvar enumValues = typeSupport.EnumValues;\n// [] = \u003c1, Red\u003e, \u003c2, Green\u003e, \u003c3, blue\u003e\nvar enumType = typeSupport.EnumType; // System.Byte\n```\n\nworking with Tuples:\n```csharp\nvar tupleType = typeof(Tuple\u003cint, string, double\u003e);\nvar valueTupleType = typeof((IVehicle, string));\nvar tupleTypeSupport = type.GetExtendedType();\nvar valueTupleTypeSupport = valueTupleType.GetExtendedType();\n\nvar isTuple = tupleTypeSupport.IsTuple; // true\nvar isValueTuple = valueTupleTypeSupport.IsValueTuple; // true\nvar tupleGenericArguments = tupleTypeSupport.GenericArgumentTypes; // System.Int32, System.String, System.Double\nvar valueTupleGenericArguments = valueTupleTypeSupport.GenericArgumentTypes; // IVehicle, System.String\n// there's lots more you can do, such as getting the value from a Tuple instance:\n\nvar car = new Car();\nvar description = \"My cool car\";\nvar myTuple = (car, description);\nvar items = myTuple.GetValueTupleItemObjects();\n// [] = Car, \"My cool car\"\n```\n\n### Object factory\n\nCreate new objects of any type:\n\n```csharp\nvar factory = new ObjectFactory();\nvar listInstance = factory.CreateEmptyObject\u003cIList\u003cint\u003e\u003e(); // List\u003cint\u003e() 0 elements\nvar dictionaryInstance = factory.CreateEmptyObject\u003cIDictionary\u003cint, string\u003e\u003e(); // Dictionary\u003cint, string\u003e() 0 elements\nvar emptyByteArray = factory.CreateEmptyObject\u003cbyte[]\u003e(); // byte[0] empty byte array\nvar byteArray = factory.CreateEmptyObject\u003cbyte[]\u003e(length: 64); // byte[64]\nvar tupleInstance = factory.CreateEmptyObject\u003c(int, string)\u003e(); // tupleInstance.Item1 = 0, tupleInstance.item2 = null\nvar myComplexObject = factory.CreateEmptyObject\u003cMyComplexObject\u003e();\n```\n\nCreate objects without parameterless constructors:\n```csharp\npublic class CustomObject\n{\n  public int Id { get; }\n  public CustomObject(int id)\n  {\n    Id = id;\n  }\n}\nvar factory = new ObjectFactory();\nvar myObj = factory.CreateEmptyObject\u003cCustomObject\u003e(); // myObj.GetType() == typeof(CustomObject)\n```\n\nYou can instruct the Object factory on how to map abstract interfaces when creating instances:\n```csharp\nvar typeRegistry = TypeRegistry.Configure((config) =\u003e {\n  config.AddMapping\u003cIVehicle, Car\u003e();\n});\n\nvar factory = new ObjectFactory(typeRegistry);\nvar car = factory.CreateEmptyObject\u003cIVehicle\u003e(); // car.GetType() == typeof(Car)\n```\n\nYou can also register custom factories:\n```csharp\nvar typeRegistry = TypeRegistry.Configure((config) =\u003e {\n  config.AddFactory\u003cIVehicle, Car\u003e(() =\u003e new Car(Color.Red));\n});\n\nvar factory = new ObjectFactory(typeRegistry);\nvar car = factory.CreateEmptyObject\u003cIVehicle\u003e(); // car.GetType() == typeof(Car)\n```\n\n### Capabilities\n\n- [x] All basic types, enums, generics, collections and enumerables\n- [x] Internal caching of type examination\n- [x] Constructor analysis (empty constructors, parameterized constructors)\n- [x] Easy listing of valid Enum values\n- [x] Easy listing of concrete types implementing an interface\n- [x] Easy listing of attributes\n- [x] Easy listing of generic arguments\n- [x] Easy listing of properties/fields\n- [x] Easy listing of implemented interfaces\n- [x] Easy listing of Tuple/ValueTuple types\n- [x] Nullable type detection\n- [x] Custom collection information detection\n- [x] Primitive / Struct detection\n- [x] Anonymous type detection\n- [x] High performance testing and optimization\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freplaysmike%2Ftypesupport","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freplaysmike%2Ftypesupport","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freplaysmike%2Ftypesupport/lists"}