Upendra Pratap Shahi

Upendra Pratap Shahi

  • 187
  • 10.4k
  • 2.1m

How to convert in lambda expression for below code-

Dec 23 2015 4:44 AM
How to convert below code snippt in lambda expression. Kindly provide me the lambda expression for this-
 
 

string[] currentRowOriginal;

currentRowOriginal = MyReader.ReadFields();

currentRow = currentRowOriginal;

string CheckFieldName, CurrentFieldName;

CheckFieldName = "";

CurrentFieldName = "";

for (int i = 0; i < currentRowOriginal.Count(); i++)

{

CheckFieldName = currentRowOriginal[i].Replace("\0", "").Trim();

int k = 1;

for (int j = i + 1; j < currentRowOriginal.Count(); j++)

{

CurrentFieldName = currentRowOriginal[j].Replace("\0", "").Trim();

//Check for duplicate column

//if (CheckFieldName.ToLower() == CurrentFieldName.ToLower())

if (String.Equals(CheckFieldName,CurrentFieldName, StringComparison.OrdinalIgnoreCase))

{

//If duplicate column exists rename it by adding incremental numeric values

k = k + 1;

currentRow[i] = CheckFieldName + "(1)";

currentRow[j] = CheckFieldName + "(" + k + ")";

}

}

}