Skip to content

Instantly share code, notes, and snippets.

@Regenhardt
Forked from lisardggY/Fluent Cast
Created May 22, 2018 15:27
Show Gist options
  • Save Regenhardt/9d0a726df103fd59acdba9e268a8ddb5 to your computer and use it in GitHub Desktop.
Save Regenhardt/9d0a726df103fd59acdba9e268a8ddb5 to your computer and use it in GitHub Desktop.
For casting an object as part of a Fluent expression without having to put annoying parentheses around casting expressions.
public static T As<T>(this object objectToCast) where T : class
{
return objectToCast as T;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment