Validate JSON against JSON Schema C#

I think that you just need to add ‘additionalProperties’: false to your schema. This will stop unknown properties being provided. So now your results will be:- True, False, False test code…. void Main() { var schema = JsonSchema.Parse( @”{ ‘type’: ‘object’, ‘properties’: { ‘name’: {‘type’:’string’}, ‘hobbies’: {‘type’: ‘array’} }, ‘additionalProperties’: false }”); IsValid(JObject.Parse( @”{ ‘name’: … Read more

How do I double buffer a Panel?

You need to derive from Panel or PictureBox. There are ramifications to this depending on how you choose to enable the buffering. If you set the this.DoubleBuffer flag then you should be ok. If you manually update the styles then you have to paint the form yourself in WM_PAINT. If you really feel ambitious you … Read more

Are IEnumerable Linq methods thread-safe?

The interface IEnumerable<T> is not thread safe. See the documentation on, which states: An enumerator remains valid as long as the collection remains unchanged. If changes are made to the collection, such as adding, modifying, or deleting elements, the enumerator is irrecoverably invalidated and its behavior is undefined. The enumerator does not have exclusive … Read more

Unlock Windows programmatically

You’ll need a custom windows credential provider to log in for you. Also, you’ll need to save the user’s credentials somewhere to log in. There are some samples in Windows SDK 7 There’s a bunch of projects to get you started under Samples\security\credentialproviders. To unlock the screen: set the username / password in CSampleCredential::Initialize … Read more