I have been using dynamic since its introduction in .net framwork 4.0. I do something like using a c# sortedlist with id and object, or other usages as assigning a complete object to a dynamic variable.
In ASP.Net MVC I never had problems assigning dynamic variables, instead of var’s but when I use it with SharePoint, it causes me this specific problem : Dynamic Operations Can Only Be Performed In Homogenous AppDomain
Let me give you an elementary background to what I would like to achieve :
Using SharePoint lists with ~30 columns each having different datatypes, its only convenient to use SortedLists where its additionally sophisticated to Search specific item/ iterate it multiple times.
Its worth pointing out, according to this blog http://cc.davelozinski.com/c-sharp/fastest-collection-for-string-lookups its charmingly clear that SortedLists on single threaded search performs well for string lengths between 12-128 chars, especially using it with SharePoint 2013 its probably very much essential.
And the developer usage was implemented as below :
In the complex world of SharePoint the OwsTimer service especially when your writing SPTimerJob based applications on SP2013, using dynamic are avoided due to LegacySecurityPolicy on runtime. C# Dynamic datatypes withdraws type checking at compilation time; instead, it resolves its type during run time.
This behaviour directly conflicts SharePoint OwsTimer jobs config file.
Workaround to this is to enable the LegacySecurityPolicy to true and using the Management Shell run the IIS reset function call.