Good evening everyone. I had the following problem - I try to use the contracts that appear in C # to check the code, but for some reason they don’t work. I have the following code:

public static string Type<T>(T some) { /* было бы очень здорово, если бы следующая строка выполнялась, чего она, однако, не делает */ Contract.Requires(some != null); return some.GetType().ToString(); } 

I work in Visual Studio 2012 Ultimate. The resharper kindly highlights the code in gray, indicating that the compiler will not need to be invoked because of the method. I probably missed something, but what?

  • Look at the project properties, maybe you forgot to include checking contracts? - VladD
  • maybe I forgot. but for some reason I don’t have the Code Contracts tab (( - DreamChild

1 answer 1

Without it will not fly :)

I just installed Visual Studio 2010, now how do I get Code Contracts?

  • thanks a lot, helped)) - DreamChild
  • @DreamChild: please! - VladD