---
title: "Difference between 'is'and 'as' operator in C#"  
description: "Difference between 'is'and 'as' operator in C#"  
author: "Anupam Mishra"  
published: 2016-01-27  
updated: 2016-01-28  
canonical: https://www.mindstick.com/forum/33935/difference-between-is-and-as-operator-in-c-sharp  
category: "c#"  
tags: ["c#", ".net"]  
reading_time: 1 minute  

---

# Difference between 'is'and 'as' operator in C#

Hi Everyone,I want to ' is ' [operator](https://www.mindstick.com/blog/144/union-intersection-and-except-operator-in-sql-server) in my program. So, please [anyone](https://www.mindstick.com/articles/23207/how-to-find-the-best-fit-job-for-anyone) can give me a exact [difference](https://www.mindstick.com/articles/157114/good-news-or-bad-news-and-the-difference-is) of 'is' and 'as' operator in c#.\
Thank you.

## Replies

### Reply by Anupam Mishra

“IS” operator is useful to check if objects are compatible with a type. For instance in the below code we are checking if “stud” object is a type of “Student” class.

```
object stud = new Student();if(stud== Student){
```

“AS” operator helps to do conversion from one type to other type. For instance in the below code we are converting object to a string data type. If the “AS” operator is not able to type cast it returns NULL**\**

```
object obj = "Anupam";string str = obj as string;
```


---

Original Source: https://www.mindstick.com/forum/33935/difference-between-is-and-as-operator-in-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
