Comment by momocowcow
3 hours ago
casey muratori would like to have a talk with you about the following :))
// Approximately what the JIT generates
if (animal?.GetType() == typeof(Dog))
{
((Dog)animal).Speak(); // devirtualized, inlinable
}
else
{
animal.Speak(); // original virtual call, hopefully rare
}
No comments yet
Contribute on Hacker News ↗