By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,419 Members | 1,371 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,419 IT Pros & Developers. It's quick & easy.

array conversions

P: n/a
Hi,

I have a class and it implement object conversion like this:

class User {
private System.DataRow row;

public User() {
this.row = null;
}

public User(System.DataRow dataRow) {
this.row = dataRow;
}

static public implicit operator User(System.Data.DataRow dataRow) {
return new User(dataRow);
}

}

this allows me to use following construct
System.DataRow [] users = table.Select();

foreach (User c in users) {
// do stuff
}

However I'd like to o step further and allow following construct:

User [] users = table.Select():

how to achieve it?
I've tried
static public implicit operator User [] (System.Data.DataRow [] dataRows){
}

and similiar but no avail as of yet.

thanks

CUIN Kaczy
Nov 16 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.