Account account1 = new Account();
account1.Id = 1;
account1.Name = "Andrew";
Account account2 = account1 as Account;
Console.WriteLine(account2.Name);
account1.Name = "Vasia";
Console.WriteLine(account2.Name);
Account account1 = new Account();
account1.Id = 1;
account1.Name = "Andrew";
Account account2 = (Account) account1;
Console.WriteLine(account2.Name);
account1.Name = "Vasia";
Console.WriteLine(account2.Name);
Account account2 = account1 as Account;
if (account2 == null)
{
// account1 - это не Account
}
else
{
// account1 - это Account
}