Add example (#24406)

* Add example

Added an example of how to use is keyword

* Fixed error in syntax highlighting
This commit is contained in:
Evaldas
2018-12-11 01:08:53 +02:00
committed by Manish Giri
parent 56bc6e028a
commit 5b489aaffa

View File

@ -5,5 +5,13 @@ title: is
## is
The `is` keyword checks if an object is compatible with a given type, or (starting with C# 7) tests an expression against a pattern.
## Example
```csharp
int number = 6;
Console.WriteLine(number is long); // False
Console.WriteLine(number is double); // False
Console.WriteLine(number is int); // True
```
#### More information:
- [C# Reference: is](https://docs.microsoft.com/dotnet/csharp/language-reference/keywords/is)