/// <summary>
 /// Determines whether the specified <paramref name="source"/> implements either <see cref="DictionaryEntry"/> or <see cref="KeyValuePair{TKey,TValue}"/>.
 /// </summary>
 /// <param name="source">The source type to check for implements of either <see cref="DictionaryEntry"/> or <see cref="KeyValuePair{TKey,TValue}"/>.</param>
 /// <returns><c>true</c> if the specified <paramref name="source"/> implements either <see cref="DictionaryEntry"/> or <see cref="KeyValuePair{TKey,TValue}"/>.; otherwise, <c>false</c>.</returns>
 public static bool IsKeyValuePair(this Type source)
 {
     return(TypeUtility.IsKeyValuePair(source));
 }
 /// <summary>
 /// Determines whether the specified <paramref name="source"/> implements either <see cref="IEnumerable"/> or <see cref="IEnumerable{T}"/>.
 /// </summary>
 /// <param name="source">The source type to check for implements of either <see cref="IEnumerable"/> or <see cref="IEnumerable{T}"/>.</param>
 /// <returns><c>true</c> if the specified <paramref name="source"/> implements either <see cref="IEnumerable"/> or <see cref="IEnumerable{T}"/>; otherwise, <c>false</c>.</returns>
 public static bool IsEnumerable(this Type source)
 {
     return(TypeUtility.IsEnumerable(source));
 }
 /// <summary>
 /// Determines whether the specified <paramref name="source"/> implements either <see cref="IDictionary"/>, <see cref="IDictionary{TKey,TValue}"/> or <see cref="IReadOnlyDictionary{TKey,TValue}"/>.
 /// </summary>
 /// <param name="source">The source type to check for implements of either <see cref="IDictionary"/>, <see cref="IDictionary{TKey,TValue}"/> or <see cref="IReadOnlyDictionary{TKey,TValue}"/></param>
 /// <returns><c>true</c> if the specified <paramref name="source"/> implements either <see cref="IDictionary"/>, <see cref="IDictionary{TKey,TValue}"/> or <see cref="IReadOnlyDictionary{TKey,TValue}"/>; otherwise, <c>false</c>.</returns>
 public static bool IsDictionary(this Type source)
 {
     return(TypeUtility.IsDictionary(source));
 }
 /// <summary>
 /// Gets the default value of the specified <paramref name="type"/>.
 /// </summary>
 /// <param name="type">The <see cref="Type"/> to retrieve its default value from.</param>
 /// <returns>The default value of <paramref name="type"/>.</returns>
 public static object GetDefaultValue(this Type type)
 {
     return(TypeUtility.GetDefaultValue(type));
 }
 /// <summary>
 /// Determines whether the specified <paramref name="source"/> implements either <see cref="IComparer"/> or <see cref="IComparer{T}"/>.
 /// </summary>
 /// <param name="source">The source type to check for implements of either <see cref="IComparer"/> or <see cref="IComparer{T}"/>.</param>
 /// <returns><c>true</c> if the specified <paramref name="source"/> implements either <see cref="IComparer"/> or <see cref="IComparer{T}"/>; otherwise, <c>false</c>.</returns>
 public static bool IsComparer(this Type source)
 {
     return(TypeUtility.IsComparer(source));
 }
 /// <summary>
 /// Determines whether the specified source type contains one or more of the specified attribute target types.
 /// </summary>
 /// <param name="source">The source type to match against.</param>
 /// <param name="inherit"><c>true</c> to search the <paramref name="source"/> inheritance chain to find the attributes; otherwise, <c>false</c>.</param>
 /// <param name="targets">The attribute target types to be matched against.</param>
 /// <returns>
 ///     <c>true</c> if the specified source type contains one or more of the specified attribute target types; otherwise, <c>false</c>.
 /// </returns>
 public static bool HasAttributes(this Type source, bool inherit, params Type[] targets)
 {
     return(TypeUtility.ContainsAttributeType(source, inherit, targets));
 }
 /// <summary>
 /// Determines whether the specified source type contains one or more of the specified target types.
 /// </summary>
 /// <param name="source">The source type to match against.</param>
 /// <param name="targets">The target types to be matched against.</param>
 /// <returns>
 ///     <c>true</c> if the specified source contains one or more of the specified target types; otherwise, <c>false</c>.
 /// </returns>
 public static bool HasTypes(this Type source, params Type[] targets)
 {
     return(TypeUtility.ContainsType(source, targets));
 }
 /// <summary>
 /// Determines whether the specified source contains one or more of the target types specified.
 /// </summary>
 /// <param name="source">The source type to match against.</param>
 /// <param name="inherit">Specifies whether to search this member's inheritance chain to find the interfaces.</param>
 /// <param name="targets">The target interface types to be matched against.</param>
 /// <returns>
 ///     <c>true</c> if the specified source contains one or more of the target types specified; otherwise, <c>false</c>.
 /// </returns>
 public static bool HasInterfaces(this Type source, bool inherit, params Type[] targets)
 {
     return(TypeUtility.ContainsInterface(source, inherit, targets));
 }
 /// <summary>
 /// Gets a sorted (base-to-derived) sequence of ancestor-and-descendant-or-self types from the <paramref name="source"/>.
 /// </summary>
 /// <param name="source">The source type to locate ancestor-and-descendant-or-self types from.</param>
 /// <param name="assemblies">The assemblies to search for the <paramref name="source"/>.</param>
 /// <returns>An <see cref="IEnumerable{Type}"/> holding the ancestor-and-descendant-or-self types from the <paramref name="source"/>.</returns>
 public static IEnumerable <Type> GetAncestorsAndDescendantsAndSelf(this Type source, params Assembly[] assemblies)
 {
     return(TypeUtility.GetAncestorAndDescendantsOrSelfTypes(source, assemblies));
 }
 /// <summary>
 /// Gets a sorted (base-to-derived) sequence of ancestor-and-descendant-or-self types from the <paramref name="source"/>.
 /// </summary>
 /// <param name="source">The source type to locate ancestor-and-descendant-or-self types from.</param>
 /// <returns>An <see cref="IEnumerable{Type}"/> holding the ancestor-and-descendant-or-self types from the <paramref name="source"/>.</returns>
 public static IEnumerable <Type> GetAncestorsAndDescendantsAndSelf(this Type source)
 {
     return(TypeUtility.GetAncestorAndDescendantsOrSelfTypes(source));
 }
 /// <summary>
 /// Gets the ancestor-or-self <see cref="Type"/> from the specified <paramref name="source"/>.
 /// </summary>
 /// <param name="source">The source type to traverse.</param>
 /// <param name="sourceBaseLimit">The base limit of <paramref name="source"/>.</param>
 /// <returns>The ancestor-or-self type from the specified <paramref name="source"/> that is derived or equal to <paramref name="sourceBaseLimit"/>.</returns>
 /// <exception cref="System.ArgumentNullException">
 /// <paramref name="source"/> - or - <paramref name="sourceBaseLimit"/> is null.
 /// </exception>
 public static Type GetAncestorsAndSelf(this Type source, Type sourceBaseLimit)
 {
     return(TypeUtility.GetAncestorOrSelf(source, sourceBaseLimit));
 }
 /// <summary>
 /// Determines whether the specified <paramref name="source"/> is an anonymous method (be that in a form of a delegate or lambda expression).
 /// </summary>
 /// <param name="source">The <see cref="Type"/> to determine is an anonymous method.</param>
 /// <returns><c>true</c> if the specified <paramref name="source"/> is an anonymous method; otherwise, <c>false</c>.</returns>
 public static bool IsAnonymousMethod(this Type source)
 {
     return(TypeUtility.IsAnonymousMethod(source));
 }