Error: Can't convert from Dictionary to IDictionary

前端 未结 1 910
栀梦
栀梦 2021-01-15 02:54

Why is there an error Error 52 Argument 1: cannot convert from \'System.Collections.Generic.Dictionary>\' to \'System.Collections.Generic.IDictionary>\'

         


        
1条回答
  •  北荒
    北荒 (楼主)
    2021-01-15 03:06

    Dictionary> implements IDictionary>, while you're trying to cast it to IDictionary>. It is not allowed, because IDictionary> has e.g. the method Add accepting instance of IList, while Add method in your Dictionary> won't accept IList as its input.

    0 讨论(0)
提交回复
热议问题