code-contracts
Code contracts on auto-implemented properties
Is there any way to put contracts on automatically implemented properties in .NET? (And how if the answe开发者_Go百科r is \'Yes\')?[详细]
2023-02-21 02:29 分类:问答C# Code Contracts: Are postconditions on members accessible from other threads useless?
after some thinking I have concluded that postconditions in methods are useful only when imposed on the return value, ref and out parameters, but not on fields, neither static nor on any instance. The[详细]
2023-02-20 04:52 分类:问答Code contracts warnings when implementing ICollection with backing collection
I\'ve got this code: public class MyCollection : ICollection<string> { private readonly ICollection<string> _inner = new Collection<string>();[详细]
2023-02-20 00:58 分类:问答Combining code contracts and regex
So I have a very simple class with one string as property. This string has to have a certain pattern. I\'m trying to enforce this using code contracts. The class looks something like this:[详细]
2023-02-15 21:27 分类:问答Code Contracts warning about possibly failing 'Assume' call
In a class of mine, I have a private field of type ExpandoObject. The field is initialized in the constructior (this.expected = new ExpandoObject()), so I\'m confident that it will never be null.[详细]
2023-02-15 02:48 分类:问答Checking preconditions in .NET
I\'m a fan of the \"fail early\"开发者_运维问答 strategy and want to check that methods params have correct values for example. In Java I\'d use something like Guava:[详细]
2023-02-15 01:16 分类:问答Why can't contract classes inherit?
开发者_Go百科If I have an interface A and interface B that extends A, can I create a contract class BContract that inherits AContract?[详细]
2023-02-12 02:50 分类:问答C# Code Contracts: What can be statically proven and what can't?
I might say I\'m getting quite familiar with Code Contracts: I\'ve read and understood most of the user manual and have been using them for quite a while now, but I still have questions. When I search[详细]
2023-02-12 02:41 分类:问答Code contracts, forall and custom enumerable
I am using C# 4.0 and Code Contracts and I have my own custom GameRoomCollection : IEnumerable<GameRoom>.[详细]
2023-02-11 13:28 分类:问答Code Contracts & Exception throwing difference
I\'m tying to understand Code Contracts advantages. I\'ve wrote following code (from PEX + Code Contract introduction) to dig it.[详细]
2023-02-11 05:38 分类:问答