Provides resource pooling of any type for performance-critical applications that allocate and deallocate objects frequently.
$ dotnet add package Net20.TypeInfoNet35.TypeInfo is a small compatibility library that backports and provides higher-level reflection helpers for older .NET frameworks (including .NET 2.0, 3.5, 4.0, 4.5) while also supporting .NET Standard 2.0. It exposes convenience extensions around core reflection types (Type, MemberInfo, MethodInfo, PropertyInfo, ParameterInfo, CustomAttributeData, Assembly, etc.) to make it easier to inspect types, members and attributes in a consistent way across multiple framework versions.
Type extension helpers to enumerate and query members consistently across runtimes.MemberInfo, MethodInfo, PropertyInfo, and ParameterInfo extension methods that simplify common reflection tasks.CustomAttributeData and custom attribute inspection without forcing attribute instantiation.Install the package from NuGet (when published) or reference the project directly in your solution.
Package id: Net35.TypeInfo (see NuGet listing for the latest version)
Use the extension methods in your code. Example:
using System;
using System.Reflection;
using Net35.TypeInfo.Extensions;
// ...
Type t = typeof(MyType);
var publicInstanceProperties = t.GetPublicInstanceProperties(); // example extension
foreach (var p in publicInstanceProperties)
{
Console.WriteLine(p.Name);
}
(Refer to the source code in Net35.TypeInfo/Extensions for the exact extension API names and signatures.)
This repository uses an SDK-style project that targets multiple TFMs. To build locally you can use the .NET SDK (for the .NET Standard target) or MSBuild/Visual Studio for full multi-target builds.
To restore and build with the .NET SDK (builds netstandard target):
dotnet build Net35.TypeInfo/Net35.TypeInfo.csproj
To build all targets including legacy .NET Framework TFMs use Visual Studio or MSBuild on Windows.
The tests are located in the Net35.TypeInfo.Tests project. They are implemented to run on .NET 3.5. Use the test runner configured in your environment (for example the included test packages in the project file).
Contributions are welcome. Please open issues or pull requests with clear descriptions and tests for any behaviour changes.
This project is licensed under the Apache-2.0 license. See the LICENSE.txt file for details.
This project was created to make it easier to write reflection-based code that works across older .NET frameworks and .NET Standard. It contains code inspired by corefx and other community libraries but implemented to be small and compatible with legacy runtimes.