What method can be used to change the index of an existing column in a datatable?

What method can be used to change the index of an existing column in a datatable?
A . Setlndex
B . MoveAt
C . SetColumnIndex
D . SetOrdinal

Answer: D

Explanation:

The SetOrdinal method of the DataColumn class can be used to change the index or position of an existing column in a datatable. The method takes an integer argument that specifies the new ordinal or position of the column. For example, to move the first column to the last position, one can use: yourDataTable.Columns(0).SetOrdinal(yourDataTable.Columns.Count – 1). (UiPath Automation

Developer study guide)

References:

DataColumn.SetOrdinal Method

How to move Column from Index 0 to Index 10 in datatable

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments