Example:
The as operator attempts to cast an object to a specific type, and returns null if it fails.
Example:
Also related
The cast operator attempts to cast an object to a specific type, and throws an exception if it fails.
Example:
Code
if (someObject is StringBuilder) ...Example:
Code
StringBuilder b = someObject as StringBuilder;
if (b != null) ...The cast operator attempts to cast an object to a specific type, and throws an exception if it fails.
Example:
Code
StringBuilder b = (StringBuilder)someObject.
Join the conversation! Your thoughts help the community grow.