private static Type GetIDictionaryType(MapTypeContext context)
 {
     return(context.TargetType.GetInterfaces()
            .Where(i => i.IsGenericType)
            .FirstOrDefault(i => i.GetGenericTypeDefinition() == typeof(IDictionary <,>) && i.GenericTypeArguments[0] == typeof(string))
            ?? throw MapCompilerException.InvalidDictionaryTargetType(context.TargetType));
 }
 private static ConstructorInfo GetDictionaryConstructor(Type targetType)
 {
     return(targetType.GetConstructor(Type.EmptyTypes) ?? throw MapCompilerException.InvalidDictionaryTargetType(targetType));
 }
 private static MethodInfo GetIDictionaryAddMethod(Type targetType, Type idictType)
 {
     return(idictType.GetMethod(nameof(IDictionary <string, object> .Add)) ?? throw MapCompilerException.InvalidDictionaryTargetType(targetType));
 }