I am extracting a bool value from a (non-generic, heterogeneous) collection.
bool
The as operator may only be used with reference types, so it is no
as
Like this:
if (rawValue is bool) { bool value = (bool)rawValue; //Do something } else { //It's not a bool }
Unlike reference types, there's no fast way to try to cast to a value type without two casts. (Or a catch block, which would be worse)