safeCast<R> method
R?
safeCast<R>()
Safely cast an object, returning null
if the casted object does not
match the casted type.
Implementation
R? safeCast<R>() {
if (this is R) return this as R;
return null;
}