Jun 26, 2016

Difference between IS and AS keyword in C#

IS keyword is responsible to checks whether  an object is compatible with a given type, and the result of the evaluation is a Boolean (true, false).
For example:
        public void emp()
            Employee oEmp = new Employee();
            if (oEmp is Employee)
            // your code

AS keyword is responsible for casting of object to a given type or class.
for Example :

Employee o = oEmp as Employee;