src/Mimp.SeeSharper.Reflection/TypeExtensions.cs
/// <summary>
/// Return the value types of <see cref="IDictionary"/>.
/// </summary>
/// <param name="type"></param>
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="InvalidOperationException">If type isn't <see cref="IDictionary"/>.</exception>
Return the value types of .
Return the value types of .
public static IEnumerable<Type>? GetIDictionaryKeyValueType(this Type type)
        {
            try
            {
                var types = type.GetGenericArguments(typeof(IDictionary<,>));
                return types.Any() ? types : null;
            }
            catch
            {
                if (type.IsIDictionary())
                    return new[] { typeof(object), typeof(object) };
                throw;
            }
        }
public static IEnumerable < Type > ? GetIDictionaryKeyValueType ( this Type type ) { try { var types = type . GetGenericArguments ( typeof ( IDictionary < , > ) ) ; return types . Any ( ) ? types : null ; } catch { if ( type . IsIDictionary ( ) ) return new [ ] { typeof ( object ) , typeof ( object ) } ; throw ; } }
Return the value types of .
Return the value types of .
None
None
If type isn't .
If type isn ' t .
Type
this
type
None