c# as code example
Example: as c#
// taking a string variable
string str1 = "GFG";
// taking an Object type variable
// assigning var1 to it
object obj1 = str1;
// now try it to cast to a string
string str2 = obj1 as string;
//here, 'as' is used to cast the object obj1 to a string,
//as the object already contained data of a string object