Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Is it possible to create a field from variable containing type?

$
0
0

Hello. I would like to do something like this:

dynamic randomField = clientContext.CastTo<someFieldObjectFromAnotherList.GetType()>(myNewField);

randomField.Update();
So ... How can I avoid code like below (supported by switch case structure)? Would be boring solution.

dynamic randomField = clientContext.CastTo<FieldNumber>(myField);

randomField.Update();







Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>