1
Reply

What is the use of "as" Keyword ?

Atulya Panda

Atulya Panda

11y
1.9k
0
Reply

    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 empEmployee emp1 = emp as Employee;Console.WriteLine(emp1.a);// emp2 would be nullvar emp2 = emp as Manager; } }