I am using c#
I have got below string in my variable.
string results = "Mr,Mike,Lewis,32,Project Manager,India";
Now I want to add these values in Dictionary type of session variable. I have declared a dict type variable in my code.
Dictionary<string, string> skywardsDetails = new Dictionary<string, string>();
Write now what I have written code was like below:
if (!string.IsNullOrEmpty(results))
{
string[] array = results.Split(',');
string title = array[0];
string firstname = array[1];
string lastname = array[2];
string age = array[3];
string designation = array[4];
string country = array[4];
//Here I want to write the new code which will add the results.Split(',') values in my Session variable as a Dictionary type.
foreach (string key in results.Split(','))
{
skywardsDetails.Add(key,//What to do here)
}
}
Please suggest
Your CSV
resultsvariable doesn’t represent a dictionary. It represents anEmployeemodel:and then: