critical section perf trick: reducing casts
If you’ve ever had to do something like this:
if(someObject is MyType)
{
var myClass = someObject as MyType;
myClass.DoStuff();
}
then give this a try in critical (perf) sections instead:
var myClass = someObject as MyType;
if(myClass!=null)
{
myClass.DoStuff();
}
it reduces your cast operations to 1 instead of two, and offers similar readability.
enjoys
-JasonS