简体   繁体   中英

C# DataTable - How to set a column to value without for loop?

I have a DataTable called dataTable that has two columns Col1 and Col2 and it contains five rows all initialized to null. How would I set the values in Col1 and Col2 to "1" and "2" respectively without using a for loop or foreach loop for each DataRow?

Use 10 assignment statements. No loop required.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM