What is difference between CreateContract and ResolveContract methods of an DefaultContractResolver instance?
What is difference between CreateContract and ResolveContract methods of an DefaultContractResolver instance?
If you look at the code, you will notice that ResolveContract is the only public method of DefaultContractResolver (not counting the constructor). This method is defined by the IContractResolver interface, which DefautContractResolver implements. It is used to resolve (that is, get or create) the JsonContract for a particular object type.
The DefaultContractResolver uses caching internally. When ResolveContract is called, it first looks in its cache to see if there is already an existing contract for the given type. If so, it returns it; otherwise, it calls the protected CreateContract method to create the contract and add it to the cache.
So, in short, CreateContract is just an implementation detail of DefaultContractResolver, while ResolveContract is the public interface.