/// <summary> /// Gets a <see cref="CachedType"/> for the given <see cref="Type"/> instance. /// </summary> /// <param name="type">The type.</param> /// <returns>The <see cref="CachedType"/>.</returns> public static CachedType ToCachedType(this Type type) { var key = "Type:" + type.FullName; if (!Cache.ContainsKey(key)) { lock (Lock) { if (!Cache.ContainsKey(key)) { Cache[key] = new CachedType(type); } } } return((CachedType)Cache[key]); }
/// <summary> /// Gets a <see cref="CachedType"/> for the given <see cref="Type"/> instance. /// </summary> /// <param name="type">The type.</param> /// <returns>The <see cref="CachedType"/>.</returns> public static CachedType ToCachedType(this Type type) { if (type.FullName == null) { // Returns an uncached version of the type since we can't build a cache key return(new CachedType(type)); } var key = "Type:" + type.FullName; if (!Cache.ContainsKey(key)) { lock (Lock) { if (!Cache.ContainsKey(key)) { Cache[key] = new CachedType(type); } } } return((CachedType)Cache[key]); }
/// <summary>Returns the contents of an XML documentation tag for the specified member.</summary> /// <param name="type">The type.</param> /// <param name="tagName">Name of the tag.</param> /// <returns>The contents of the "summary" tag for the member.</returns> public static string GetXmlDocsTag(this CachedType type, string tagName) { return(type.Type.GetXmlDocsTag(tagName)); }
/// <summary>Returns the contents of the "remarks" XML documentation tag for the specified member.</summary> /// <param name="type">The type.</param> /// <returns>The contents of the "summary" tag for the member.</returns> public static string GetXmlDocsRemarks(this CachedType type) { return(type.Type.GetXmlDocsRemarks()); }
/// <summary>Returns the contents of the "summary" XML documentation tag for the specified member.</summary> /// <param name="type">The type.</param> /// <returns>The contents of the "summary" tag for the member.</returns> public static string GetXmlDocsSummary(this CachedType type) { return(type.Type.GetXmlDocsSummary()); }
/// <summary>Checks whether the given type is assignable to the given type name.</summary> /// <param name="type">The type.</param> /// <param name="typeName">Name of the type.</param> /// <param name="typeNameStyle">The type name style.</param> /// <returns></returns> public static bool IsAssignableToTypeName(this CachedType type, string typeName, TypeNameStyle typeNameStyle) { return(type.OriginalType.IsAssignableToTypeName(typeName, typeNameStyle)); }
private static string GetNullableDisplayName(CachedType type, string actual) { return((type.IsNullableType ? "Nullable" : "") + actual); }