C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,282 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
How do you get the column name given the column index using a streamreader?
In simple cases, try something like this:
int column_index = . . .
string column_name;
using( StreamReader sr = new StreamReader( "MyFile.csv"))
{
string line = sr.ReadLine( );
var a = line.Split( ",")
column_name = a[column_index];
}