Tag: comparison
Case insensitive string comparison for Contains in C#
When using the string.contains method , the comparison is done based on the exact string that is passed as parameter. In this case , the comparison is case-sensitive. using System; namespace ACConsoleApp { class Program { static void Main(string[] args) { string input = “This is a WeLcome string”; var output = input.Contains(“Welcome”); Console.WriteLine(output); Console.ReadLine(); } } } In the above code snippet , the…
How to compare only Date without Time in DateTime datatype in C#?
There are times when you might want to compare only the date parts of two DateTime variable in C#. How to compare only Date without Time in DateTime datatype in C#? You can easily compare using the Date property from the DateTime object.