.NET Fiddle

CSharp · Console

/Program.cs

using System;

public static class StringExtensions {
	public static bool ToBool(this string value){
		return value.ToLower() == "yes";
	}
	
	public static DateTime ToDate(this string value){
		return DateTime.TryParse(value, out DateTime result) ? result : DateTime.MinValue;
	}	
}
			
public class Program
{
	public static void Main()
	{
        Console.WriteLine("{\"Yes\".ToBool()} Should return True. Actual value: " + "Yes".ToBool());
		Console.WriteLine("{\"No\".ToBool()} Should return False. Actual value: " + "No".ToBool());
		Console.WriteLine("{\"12-Oct-2022\".ToDate()} Should return 12-Oct-2022. Actual value: " + "12-Oct-2022".ToDate().ToString("dd-MMM-yyyy"));
		Console.WriteLine("{\"\".ToDate()} Should return 01-Jan-0001. Actual value: " + "".ToDate().ToString("dd-MMM-yyyy"));
	}
}
;