Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Why doesn't this require a cast?
Message
 
To
All
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
Why doesn't this require a cast?
Miscellaneous
Thread ID:
01026305
Message ID:
01026305
Views:
59
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
Next
Reply
Map
View

Click here to load this message in the networking platform