Changed GetAttrForObj/Type access to protected

pull/10/head
David Hall 2018-06-28 18:00:56 -06:00
parent c85b8d8fc4
commit 749d3702a9
1 changed files with 8 additions and 2 deletions

View File

@ -101,7 +101,10 @@ namespace Vanara.InteropServices
/// <returns>The types defined by the attribute.</returns> /// <returns>The types defined by the attribute.</returns>
public static IEnumerable<Type> GetCorrespondingTypes(Type type) => GetAttrForType(type).Select(a => a.TypeRef); public static IEnumerable<Type> GetCorrespondingTypes(Type type) => GetAttrForType(type).Select(a => a.TypeRef);
private static IEnumerable<CorrespondingTypeAttribute> GetAttrForObj(object value) /// <summary>Gets the CorrespondingTypeAttribute instances associated with an enum value.</summary>
/// <param name="value">The enum value.</param>
/// <returns>An enumeration of all associated CorrespondingTypeAttribute instances.</returns>
protected static IEnumerable<CorrespondingTypeAttribute> GetAttrForObj(object value)
{ {
if (value == null) throw new ArgumentNullException(nameof(value)); if (value == null) throw new ArgumentNullException(nameof(value));
var valueType = value.GetType(); var valueType = value.GetType();
@ -112,7 +115,10 @@ namespace Vanara.InteropServices
return attr; return attr;
} }
private static IEnumerable<CorrespondingTypeAttribute> GetAttrForType(Type type) /// <summary>Gets the CorrespondingTypeAttribute instances associated with a type.</summary>
/// <param name="type">The type.</param>
/// <returns>An enumeration of all associated CorrespondingTypeAttribute instances.</returns>
protected static IEnumerable<CorrespondingTypeAttribute> GetAttrForType(Type type)
{ {
if (type == null) throw new ArgumentNullException(nameof(type)); if (type == null) throw new ArgumentNullException(nameof(type));
var attr = type.GetCustomAttributes<CorrespondingTypeAttribute>(); var attr = type.GetCustomAttributes<CorrespondingTypeAttribute>();