Atulya Panda
What is the use of "as" Keyword ?
Posted by Atulya Panda in ASP.NET Programming on Nov 26, 2012
  • 0
  • 1
  • 1398
Do you know the answer for this question? Post it below.
Guest
Posted by Ramakrishna on Dec 04, 2012
  • 0

As operator allows you to perform conversions between compatible reference types. Consider the following example... using System; class Employee { public int a = 10; } class Manager : Employee { } class Program { static void Main(string[] args) { Employee emp = new Employee(); // emp1 would point to the same object as emp Employee emp1 = emp as Employee; Console.WriteLine(emp1.a); // emp2 would be null var emp2 = emp as Manager; } }


Download Free eBooks

Most Popular Companies

Most Popular Job Functions

MOST LIKED QUESTIONS