Search code examples
c#visual-studio-2010late-bindingdynamic-keywordlate-bound-evaluation

C# - Disable Dynamic Keyword


Is there any way to disable the use of the "dynamic" keyword in .net 4?

I thought the Code Analysis feature of VS2010 might have a rule to fail the build if the dynamic keyword is used but I couldn't fine one.


Solution

  • It's part of the C# 4.0 language, so no not really.

    You can use FXCop to look for it though and fail the build if it encounters it.

    Style cop might work instead:

    http://code.msdn.microsoft.com/sourceanalysis

    Here is a link talking about the same issue and how style cop might be the answer. There is also a post about how to get FX cop to potentially look for the dynamic keyword, although it's not perfect.

    http://social.msdn.microsoft.com/Forums/en/vstscode/thread/8ce407ba-bdf7-422b-bbcd-ca4701c3a76f