This may be a bit overkill for what you want to do, but...
Human readable strings for enum elements[
^]
BTW: Why are you declaring it as an object array? Why not as an array of enumIC instead?
because this is my function
public static void ValidateGridFields(string ColumnList, int iRow, DataGridView Grid)
{
string[] sColumn = ColumnList.Split(',');
for (int i = 0; i < sColumn.Length; i++)
{
int CNo = Convert.ToInt32(sColumn[i]);
if (Grid[CNo, iRow].Value + "" == "")
Grid.Rows[iRow].Cells[CNo].Style.BackColor = Color.LightBlue;
else
{
if (Grid.Rows[iRow].Cells[CNo].Style.BackColor == Color.LightBlue)
Grid.Rows[iRow].Cells[CNo].Style.BackColor = Color.White;
}
}
}
for valadating grid
and i want to send argument like this
ValidateGridFields("1,2,3,4",1,DataGridView1
first argument is our value
Ah! So what you want is to be handed an array of enumIC values, and return a string of the numerical values?
I would use an array of the enum values:
private enum enumIC
{
eSelect,
eID,
eEdit,
eCETSH,
eDesc,
eTGoods,
eSchedule,
eUOM,
eRODA,
eRODS,
eDel
}
enumIC[] obj = new enumIC[] { enumIC.eCETSH, enumIC.eDesc, enumIC.eTGoods, enumIC.eUOM, enumIC.eRODA, enumIC.eRODS };
...
Console.WriteLine(GetStringFromEnumArray(obj));
...
private static string GetStringFromEnumArray(enumIC[] ar)
{
StringBuilder sb = new StringBuilder();
string sep = "";
foreach(enumIC e in ar)
{
sb.AppendFormat("{0}{1}", sep, (int)e);
sep = ",";
}
return sb.ToString();
}