Anonymous Types

前端 未结 5 854
北恋
北恋 2021-01-12 17:41

I have a Dictionary(TKey, TValue) like

Dictionary Deduction_Employees = 
    new Dictionary();

5条回答
  •  生来不讨喜
    2021-01-12 18:22

    If you are using .NET 1.x - 3.x, you must use reflection.

    If you use .NET 4.0, you could use a dynamic type and call the expected properties.

    In neither case do you need to unbox; that's for value types. Anonymous types are always reference types.

提交回复
热议问题