Cast an Anonymous Types in Object and retrieve one Field

前端 未结 4 1900
闹比i
闹比i 2020-12-03 23:18

I use C# asp.net4.

I have a method to populate a Repeater with Anonymous Types (Fields: Title, CategoryId), inside the Repeater I also placed a Label:



        
4条回答
  •  南方客
    南方客 (楼主)
    2020-12-04 00:20

    Can't you just cast to (typeof(new { Title = "", CategoryID = 0 }))?

提交回复
热议问题