C#
Condition based type casting
public void Method(BaseClass entry)
{
if (entry is not ExtendedClass extendedEntry) {
return;
}
// `extendedEntry` is now of type ExtendedClass
// if it can't be converted, break out of the function
}
Assistant
Responses are generated using AI and may contain mistakes.