/// <summary> /// Get the <see cref="MethodAccess"/> level used by this component for the type <typeparamref name="T"/>. /// </summary> /// <returns>A <see cref="MethodAccess"/> instance.</returns> public MethodAccess GetAccessLevel <T>() { Type type = typeof(T); if (type.Assembly == typeof(object).Assembly) { return(MethodAccess.Public); } else { XMachineAssemblyAttribute xma = type.Assembly.GetCustomAttribute <XMachineAssemblyAttribute>(); return(xma == null ? AccessIncluded : xma.ConstructorAccess); } }
/// <summary> /// Get the appropriate <see cref="MemberAccess"/> level for the given type <typeparamref name="T"/>. /// </summary> /// <returns>An instance of <see cref="MemberAccess"/>.</returns> public MemberAccess GetPropertyAccess <T>() { Type type = typeof(T); if (type.Assembly == typeof(object).Assembly) { return(MemberAccess.PublicOnly); } else { XMachineAssemblyAttribute xma = type.Assembly.GetCustomAttribute <XMachineAssemblyAttribute>(); return(xma == null ? AccessIncluded : xma.PropertyAccess); } }