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

Generic List pass by value?

P: 10
I'm looping throug a DataTable and want to pass a temp List<T> to a class, then clear the temp List<T>, then repeat... Is there a way to do this without passing by reference?

Dec 28 '08 #1
Share this Question
Share on Google+
1 Reply

Expert 100+
P: 221
You can't pass the generic list "by value" because it's a reference type.
If you don't want to pass that instance for whatever reason you could clone or copy the list before passing it to your other class.
Dec 28 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.