Convert to IEnumerable?

前端 未结 4 1106
别那么骄傲
别那么骄傲 2021-02-14 13:13

I wrote this extension method :

public static class A
{
 public static IEnumerable AsDynamic(this IEnumerable f)
    {
                 


        
4条回答
  •  醉话见心
    2021-02-14 14:03

    By design, runtime bindings behave as similarly as possible to static binding.

    So the runtime type would betypeof (IEnumerable)

    The static type would be typeof (IEnumerable)

    Also

    The runtime treats this true conceptually

    typeof(object)==typeof(dynamic)
    

    So,

    A dynamic type is like object except it lets you use in ways that aren't known at compile time.

    提交回复
    热议问题