Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why doesn't this require a cast?
Message
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
Why doesn't this require a cast?
Divers
Thread ID:
01026305
Message ID:
01026305
Vues:
61
Hoping someone can help me understand what is happening here. Consider this code:
public override bool CheckRulesHook(DataSet ds, string tableName)
{
	foreach (UsersDataSet.rb_UsersRow row in ds.Tables[tableName].Rows)
	{
		ValidateAddress(row);
	}
}
Passed in to the method is a System.Data.DataSet, however, I can use my typed data row in the foreach without trouble. This seems strange because ds.Tables[tableName].Rows returns a DataRowCollection that is a collection of DataRows, not a collection of my typed rows.

I would think I'd need to cast here, but it's not required. Why is this?

Thanks,
Mike
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform