/// <summary> /// Obtains a reflection wrapper for a parameter. /// </summary> /// <param name="target">The parameter, or null if none.</param> /// <returns>The reflection wrapper, or null if none.</returns> public static IParameterInfo Wrap(ParameterInfo target) { if (target == null) { return(null); } IUnresolvedCodeElement unresolvedTarget = target as IUnresolvedCodeElement; if (unresolvedTarget != null) { return((IParameterInfo)unresolvedTarget.Adapter); } return(new NativeParameterWrapper(target)); }
/// <summary> /// Obtains a reflection wrapper for a constructor. /// </summary> /// <param name="target">The constructor, or null if none.</param> /// <returns>The reflection wrapper, or null if none.</returns> public static IConstructorInfo Wrap(ConstructorInfo target) { if (target == null) { return(null); } IUnresolvedCodeElement unresolvedTarget = target as IUnresolvedCodeElement; if (unresolvedTarget != null) { return((IConstructorInfo)unresolvedTarget.Adapter); } return(new NativeConstructorWrapper(target)); }
/// <summary> /// Obtains a reflection wrapper for a field. /// </summary> /// <param name="target">The field, or null if none.</param> /// <returns>The reflection wrapper, or null if none.</returns> public static IFieldInfo Wrap(FieldInfo target) { if (target == null) { return(null); } IUnresolvedCodeElement unresolvedTarget = target as IUnresolvedCodeElement; if (unresolvedTarget != null) { return((IFieldInfo)unresolvedTarget.Adapter); } return(new NativeFieldWrapper(target)); }
/// <summary> /// Obtains a reflection wrapper for a type. /// </summary> /// <param name="target">The type, or null if none.</param> /// <returns>The reflection wrapper, or null if none.</returns> public static ITypeInfo Wrap(Type target) { if (target == null) { return(null); } IUnresolvedCodeElement unresolvedTarget = target as IUnresolvedCodeElement; if (unresolvedTarget != null) { return((ITypeInfo)unresolvedTarget.Adapter); } return(target.IsGenericParameter ? new NativeGenericParameterWrapper(target) : new NativeTypeWrapper(target)); }