Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 446
chief7 Avatar asked May 07 '10 20:05

chief7


1 Answers

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

like image 196
kemiller2002 Avatar answered Oct 03 '22 18:10

kemiller2002