Is there a way to check whether a C# cast will be successful? In some cases; based on how a rendered page is put together; inheriting from different Master Pages, some casts will work and others will not.
I am wondering how I can check to see if a cast will be successful or if I just have to catch and handle an invalid cast exception.
Is there a way to check whether a C# cast will be successful? In
Share
You can say :
Or
Variable will be null if casting was not possible.