1
I have the following variable
List<MyFile> xmlDisponivel = new List<MyFile>();
This variable is a list of the following class
public class MyFile
{
public string FileName { get; set; }
public string FilePath { get; set; }
}
In a process I save the list that assigns this variable in a Session
Session.Add("XmlDisponivel", xmlDisponivel);
In another process when I will try to take this information from Ssion and move to my type variable List<MyFile> always comes null even if you have information on the list.
As print below, I have a list of 400 files, but when I try to convert from Session to my variable, it always comes null.
How to solve, some idea?

And how are you doing the Cast of
SessionforList? Edita your question for us to see :)– Marconi
var lista = (List<MyFile>) Session["XmlDisponivel"];?– OnoSendai
@Onosendai shows in print that the conversion does not work.
– Jéf Bueno
@jbueno
obj as type!=(type) obj. The operatorasonly considers reference and Boxing/Unboxing.– OnoSendai
Instead of setting like this:
Session.Add("XmlDisponivel", xmlDisponivel);, set like this:Session["XmlDisponivel"] = xmlDisponivelalso doesn’t work?– igventurelli
@Onosendai It worked perfectly, obg!! Obg a tds who tried to help!
– WellDotCom
@Wellitonmeneguim Always a pleasure to help! A suggestion - create an answer describing your solution, and mark it as such. So you help future site visitors. =)
– OnoSendai