public static class Th
{
public static T e<T>(T theObject) where T : class
{
return theObject;
}
}
public static class ObjectExtensions
{
public static bool Is<T>(this T o, Func<T, bool> a) where T : class
{
return a(o);
}
}
//...
//logic in a method somewhere
Func<string, bool> valid = property => _myService.SomeValidationMethod(property);
if (Th.e(_request.Property).Is(valid))
{
//do something
}
Is this code suitable for production and why?
Edit: Thank you for all your comments. I hope you had as much fun reading my stretching of the C# syntax to breaking point as I did reading your responses.
I have no problem with fluent APIs, but this seems to violate the principle of least surprise. I would not understand the purpose of a class named
Th
nor of a method namede
.