jason-c-daniels - Jcd.Reflection 2.0.13

A dotnetstandard2.0 library containing some commonly implemented reflection helpers.

PM> Install-Package Jcd.Reflection -Version 2.0.13 -Source https://www.myget.org/F/jason-c-daniels/api/v3/index.json

Copy to clipboard

> nuget.exe install Jcd.Reflection -Version 2.0.13 -Source https://www.myget.org/F/jason-c-daniels/api/v3/index.json

Copy to clipboard

> dotnet add package Jcd.Reflection --version 2.0.13 --source https://www.myget.org/F/jason-c-daniels/api/v3/index.json

Copy to clipboard
<PackageReference Include="Jcd.Reflection" Version="2.0.13" />
Copy to clipboard
source https://www.myget.org/F/jason-c-daniels/api/v3/index.json

nuget Jcd.Reflection  ~> 2.0.13
Copy to clipboard

> choco install Jcd.Reflection --version 2.0.13 --source https://www.myget.org/F/jason-c-daniels/api/v2

Copy to clipboard
Import-Module PowerShellGet
Register-PSRepository -Name "jason-c-daniels" -SourceLocation "https://www.myget.org/F/jason-c-daniels/api/v2"
Install-Module -Name "Jcd.Reflection" -RequiredVersion "2.0.13" -Repository "jason-c-daniels" 
Copy to clipboard

Jcd.Reflection

A dotnetstandard2.0 library containing some commonly implemented reflection helpers.

v2.0 has many breaking changes. See the Version History for details.

Examples

    internal static class Program
    {
        private static void Main()
        {
            var c = new TestClass();
            // set the private field, _field
            c.SetValue("_field",10);

            // now get its value.
            var val = (int)c.GetValue("_field");
            Console.WriteLine(val);

            // Now set a private property with a backing field.
            c.SetValue("PrivateProperty",20);

            // Now call a private helper method that returns the value from the backing field.
            val = c.Invoke<int>("InternalGetField");
            Console.WriteLine(val);

Special Thanks To

Scrutor inspired the technique I'm using for finding implementations of specific types as well as a couple of other handy utility methods.

Badges

GitHub Build status CodeFactor Grade

MyGet Nuget

API Docs

Version History

v2.0 Breaking Changes

Version 2.0 comes with a significant number of breaking changes for advanced use cases. These are listed below

  • ExpandoObjectExtensions was removed. It wasn't functioning as planned. An overhaul of the approach is needed.
  • All overloads of FilterMethods were renamed to GetMethods
  • The filter parameter was moved to the last parameter on an overload of GetMethods (formerly FilterMethods).
  • Renamed EnumerationSettings to Filter in MemberInfoEnumerator, FieldOrPropertyEnumerator, and MethodInfoEnumerator
  • Moved and renamed type from MethodInfoEnumerator.Settings to MethodInfoFilter.
  • Moved predefined instances of MethodInfoEnumerator.Settings from MethodInfoEnumerator to MethodInfoFilter.
  • Moved and renamed type from MemberInfoEnumerator.Settings to MemberInfoFilter.
  • Moved and renamed type from FieldOrPropertyEnumerator.Settings to FieldOrPropertyInfoFilter.
  • MethodInfoFilter, MemberInfoFilter, FieldOrPropertyInfoFilter fields are now get-only properties, requiring a call to new to create new instances.
  • To facilitate the use of init properties on MethodInfoFilter, MemberInfoFilter, FieldOrPropertyInfoFilter types, a custom IsExternalInit is required of target frameworks not supporting it. See this project's source code for an example (IsExternalInit.cs).
  • Extension methods GetCusomAttributes and HasAttribute were moved into classes named after the underlying method. This will only break non-extension invocations.

refactored extension method class names

  • .NETStandard 2.0
    • Jcd.Validations (>= 1.2.0)
    • Microsoft.CSharp (>= 4.7.0)
  • .NETStandard 2.0: 2.0.0.0

Owners

Jason C. Daniels

Authors

Jason C Daniels

Project URL

https://github.com/jason-c-daniels/Jcd.Reflection

License

MIT

Tags

reflection csharp c#

Info

109 total downloads
0 downloads for version 2.0.13
Download (45.39 KB)
Found on the current feed only

Package history

Version Size Last updated Downloads Mirrored?
2.0.26 45.06 KB Sun, 31 Mar 2024 20:33:54 GMT 2
2.0.18 45.4 KB Sun, 31 Mar 2024 19:26:29 GMT 0
2.0.13 45.39 KB Sun, 31 Mar 2024 14:47:43 GMT 0
2.0.12 45.39 KB Sun, 31 Mar 2024 14:41:21 GMT 0
2.0.7 45.38 KB Thu, 28 Mar 2024 22:49:49 GMT 2
2.0.0 45.51 KB Mon, 11 Mar 2024 00:15:51 GMT 2
1.0.61 49.89 KB Sun, 10 Mar 2024 20:56:31 GMT 0
1.0.57 49.72 KB Sun, 26 Mar 2023 23:41:45 GMT 2
1.0.56 49.72 KB Sun, 26 Mar 2023 23:36:41 GMT 6
1.0.53 49.61 KB Sun, 26 Mar 2023 23:29:19 GMT 3
1.0.52 49.55 KB Sun, 26 Mar 2023 23:16:42 GMT 2
1.0.51 49.56 KB Sun, 26 Mar 2023 21:19:01 GMT 4
1.0.47 49.55 KB Sun, 26 Mar 2023 20:28:38 GMT 6
1.0.42 49.55 KB Sat, 25 Mar 2023 18:27:40 GMT 4
1.0.41 45 KB Thu, 23 Mar 2023 17:29:26 GMT 4
1.0.40 43.59 KB Thu, 14 Oct 2021 02:28:42 GMT 3
1.0.39 39.77 KB Tue, 12 Oct 2021 11:38:32 GMT 3
1.0.38 38.55 KB Mon, 11 Oct 2021 16:56:45 GMT 3
1.0.37 38.55 KB Mon, 11 Oct 2021 16:55:37 GMT 2
1.0.36 38.55 KB Mon, 11 Oct 2021 16:54:13 GMT 2
1.0.35 38.56 KB Mon, 11 Oct 2021 16:51:10 GMT 2
1.0.34 38.56 KB Mon, 11 Oct 2021 03:26:31 GMT 2
1.0.33 38.55 KB Sun, 10 Oct 2021 23:54:07 GMT 3
1.0.30 38.5 KB Sun, 10 Oct 2021 23:36:47 GMT 2
1.0.29 38.58 KB Sun, 10 Oct 2021 23:35:25 GMT 2
1.0.26 38.57 KB Sun, 10 Oct 2021 03:43:09 GMT 1
1.0.25 38.58 KB Sun, 10 Oct 2021 03:13:49 GMT 2
1.0.24 37.34 KB Sun, 10 Oct 2021 00:58:02 GMT 2
1.0.23 37.33 KB Sun, 10 Oct 2021 00:19:28 GMT 2
1.0.22 37.34 KB Sun, 10 Oct 2021 00:14:42 GMT 2
1.0.21 37.33 KB Sun, 10 Oct 2021 00:02:52 GMT 2
1.0.20 37.33 KB Sat, 09 Oct 2021 23:38:27 GMT 2
1.0.19 37.33 KB Sat, 09 Oct 2021 23:29:02 GMT 2
1.0.18 37.34 KB Sat, 09 Oct 2021 23:16:09 GMT 2
1.0.17 37.16 KB Sat, 09 Oct 2021 23:02:27 GMT 2
1.0.16 36.45 KB Sat, 09 Oct 2021 22:08:18 GMT 2
1.0.15 36.45 KB Sat, 09 Oct 2021 22:05:10 GMT 2
1.0.14 34.27 KB Sat, 09 Oct 2021 20:03:05 GMT 2
1.0.13 31.97 KB Sat, 09 Oct 2021 19:52:58 GMT 2
1.0.12 30.14 KB Sat, 09 Oct 2021 13:53:04 GMT 11
1.0.11 30.14 KB Sat, 09 Oct 2021 13:29:35 GMT 1
1.0.8 27.11 KB Sat, 09 Oct 2021 07:52:19 GMT 2
1.0.4 26.79 KB Sat, 09 Oct 2021 05:21:18 GMT 2
1.0.2 25.79 KB Sat, 09 Oct 2021 01:00:23 GMT 1
1.0.1 13.83 KB Fri, 08 Oct 2021 22:46:28 GMT 2
1.0.0 13.55 KB Fri, 08 Oct 2021 22:34:24 GMT 2