Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

8
  • 4
    That would solve a problem with creating the list, but it wouldn't solve the problem of reading values back, since now I would have to cast to an appropriate Field<_type_> , and there is no way I know the _type_ at that time... Commented Oct 21, 2013 at 9:55
  • 1
    thanks for a good idea. I ended up discovering that I need an extended functionality and therefore went with an abstract class and a factory pattern to create all different types of fields. I am marking your answer as correct since attempt at implementing an interface like you suggested led me to my final, working solution. Thanks. Commented Oct 21, 2013 at 10:18
  • 1
    You get a list of IField's, which contain no data. Commented Jun 8, 2016 at 14:50
  • 6
    @Wish, they contain data; that data just isn't accessible without casting. Looking at this answer three years later though, I do not understand why it was upvoted. The var type = field.Type; line is nonsense and wouldn't compile. Commented Jun 8, 2016 at 15:22
  • 3
    @DavidArno 2 years later, I stumbled upon this question and I noticed that var type = field.Type won't compile, however, there's a simple fix for that. You could simply use dynamic type = field.Type and everything is good to go. So maybe adding this to the answer helps someone. Thank you. Commented Apr 20, 2018 at 5:58