Use of Is and As operators in C#
The
is
operator checks if an object can be cast to a specific type.Theif
(someObjectis
StringBuilder)
as
operator attempts to cast an object to a specific type, and returns null if it fails.
StringBuilder b = someObject as
StringBuilder;
Comments
Post a Comment