Here is an Linq extension which returns your custom error message in cause of an exception. Linq Implemented: First, Last, Single String Implemented: Left, Right Stopwatch: ToFormatedString
- .NET Standard 2.0
- .NET Standard 1.5
- .NET Standard 1.3
- .NET 4.6.1
- .NET 4.5
List<string> newList = new List<string> {"1234", "987654"};
newList.SingleOrDefault(x => x == "searchString", "custom error message e.g. search string mot in list");
string testString = "anyTestText";
var result = testString.Left(4);
// result == "anyT"
string testString = "anyTestText";
var result = testString.Right(4);
// result == "Text"
string testString = "Add Additional String";
var result = testString.ReplaceExactWord("Add", "Insert");
// result == "Insert Additional String"
var result = m_Stopwatch.ToFormatedString("g")
// result == "0:00:01,5"
var result = m_Stopwatch.ToFormatedString(@"mm\:ss\.ff")
// result == "00:01.50"
DateTime result = new DateTime(2019, 1, 22).WeekBeginn();
// result == new DateTime(2018, 12, 31)
int result = new DateTime(2016, 2, 22).DaysInMonth()
// result == 29