I wanted to know if it is possible to concatenate an array to a session variable that already has an array in it:
private string GetParametros(string valores)
{
try
{
string[] datos;
if (Session["parametros"] == null)
{
datos = valores.Split(';');
Session["parametros"] = datos;
}
else
{
datos = valores.Split(';');
Session["parametros"] = Session["parametros"] + datos;
}
}
}
In case session["parameters"] is null, it is created for me with the string that the function receives, transforming the string into an array, and then when I go back through the function I want to add the new values that arrive at Session["parameters "].
Obviously I'm doing something wrong because Session["parametros"] = Session["parametros"] + datos;
it throws me an error.
Does anyone know how I can fix it?
From already thank you very much.
You can do the following:
string
in your case.Concat()
the libraryusing System.Linq;
that you can import and at the end an is appliedToArray()
to save them as an array type.With this you would have the following:
I hope this helps you with your problem.