How to make String.Contains case insensitive?

The string.Contains() method in C# is case sensitive. And there is not StringComparison parameter available similar to Equals() method, which helps to compare case insensitive. If you run the following tests, TestStringContains2() will fail. Other option is using like this. And here is the case insensitive contains method implementation. And here is the modified tests.Read More

How to convert JSON to XML and vice versa in C#

Json.NET supports converting JSON to XML and vice versa using the XmlNodeConverter. The JsonConvert has two helper methods for converting between JSON and XML. The first is SerializeXmlNode(). This method takes an XmlNode and serializes it to JSON text. The second helper method on JsonConvert is DeserializeXmlNode(). This method takes JSON text and deserializes itRead More