Code Monkey home page Code Monkey logo

reflectionbridge's Introduction

ReflectionBridge

Build status

NuGet Badge

Provides some extensions which define a bridge for the differences between Type and TypeInfo.

This library can be used for the following Frameworks:

  • net2.0
  • net3.5
  • net4.0
  • net4.5
  • net4.5.x
  • net4.6
  • net4.6.1
  • netcore4.5 Windows Store apps [only up until version 0.0.12]
  • netcore4.5.1 Windows Store apps (Windows 8.1) [only up until version 0.0.12]
  • netcore5.0 Windows Universal [only up until version 0.0.12]
  • dnx451 [only up until version 0.0.12]
  • dnxcore5 [only up until version 0.0.12]
  • uap10.0
  • sl5 (SilverLight 5.0) [only up until version 0.0.12]
  • netstandard1.3 and up

So instead of doing this in your code:

string s = "example";
#if (!(NET40 || NET35 || NET20))
Type t = s.BaseType;
#else
Type t = s.GetTypeInfo().BaseType;
#endif

You can just do:

string s = "example";
Type t = s.BaseType();

An extension method in this project like this does the if-def:

        public static Type BaseType(this Type type)
        {
#if REFLECTIONBRIDGE && (!(NET40 || NET35 || NET20))
            return type.GetTypeInfo().BaseType;
#else
            return type.BaseType;
#endif
        }

Please provide feedback on this project.

reflectionbridge's People

Contributors

shazwazza avatar stefh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

reflectionbridge's Issues

Is it compatible with System.Reflection.TypeExtensions ?

When using this two libraries together am getting this:

error CS0121: The call is ambiguous between the following methods or properties: 'System.Reflection.TypeExtensions.GetGenericArguments(System.Type)' and 'ReflectionBridge.Extensions.ReflectionBridgeExtensions.GetGenericArguments(System.Type)

when building using netstandard1.3

Missing a few methods

So far this is very helpful for porting over some code but it's missing a few methods like:

IsSealed
IsAbstract

Nuget package ?

Is it allowed to copy the classes in my own project ?, since there is no nuget package to include

Apache 2.0 vs. MIT License

Thanks for sharing ReflectionBridge. I'm contributing to a project which is licensed under The MIT License, where ReflectionBridge could be really helpful. Not sure whether the project owner would accept parts under Apache 2.0. MIT is not an option for ReflectionBridge, is it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.