Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > Collections and Properties
 

Collections and Properties

Quick question, right now if I wanna say change all the columns in my datagridview to notsortable, I am itterating through them, but what I am wondering is if there is anyway to set a property on collections of the same items without itterating. I have no idea if this is possible but if it was, I would have to think it would be more efficient. Just interested thanks
natetrost  Wednesday, December 14, 2005 6:20 PM
Arrays and List<T> support ForEach() which can do that.  Collection and Collection<T> do not support this operation but you could create wrapper classes (if possible) to do it.  Ultimately though it'll still boil down to a for-each loop.  This is available as of .NET 2.0.

Michael Taylor - 12/15/05
TaylorMichaelL  Thursday, December 15, 2005 1:57 PM
Arrays and List<T> support ForEach() which can do that.  Collection and Collection<T> do not support this operation but you could create wrapper classes (if possible) to do it.  Ultimately though it'll still boil down to a for-each loop.  This is available as of .NET 2.0.

Michael Taylor - 12/15/05
TaylorMichaelL  Thursday, December 15, 2005 1:57 PM

You can use google to search for other answers

Custom Search

More Threads

• Updating one column in a DataTable each time another Column is updated, for a given row
• 1 DataGridView 2 data source
• change the value of two dimension array via DataGridView
• How to control record deletion using BindingNavigator?
• Add/remove data from dataGridView?
• oledb and datagridview help needed![URGENT]
• DataGridViewColumn - DropDownDataGridView
• AddNew()'s new item no longer set to Current on a BindingSource?
• programmatically find a row in a DataGridView and select it
• select a row from the rowheader..