Search code examples
c#portable-class-library

I cant use dynamic with Portable Class Library?


In a class in my PCL project ive defined

protected dynamic model;

Thought it was smart b'cuz model could then be anything to the children that inherit this class. But it will not build, stating:

Cannot define a class or member that utilizes 'dynamic' because the compiler required type 'System.Runtime.CompilerServices.DynamicAttribute' cannot be found. Are you missing a reference?

Am I missing something, or it cant be done?


Solution

  • You are missing the runtime support for dynamic, provided by the Microsoft.CSharp assembly. It is not available when your library targets one of the "old" frameworks: XBox or Windows Phone 7.x.