Jump to content
Wikibooks The Free Textbook Project

C# Programming/Keywords/as

From Wikibooks, open books for an open world
The latest reviewed version was checked on 27 July 2017. There are template/file changes awaiting review.

The as keyword casts an object to a different type. It is therefore similar to the TypeAvarA = (TypeA)varB syntax. The difference is that this keyword returns null if the object was of an incompatible type, while the former method throws a type-cast exception in that case.

See also

[edit | edit source ]



C# Keywords
Special C# Identifiers (Contextual Keywords)
Contextual Keywords (Used in Queries)

AltStyle によって変換されたページ (->オリジナル) /