class Variable
{
char ascii;
double probabilidad;
int codigo;
public Variable()
{ }
public void llenar(char letra, double prob)
{
ascii = letra;
probabilidad = prob;
}
public double Probabiliada
{
get
{
return probabilidad;
}
}
public int Codigo
{
set
{
codigo = value;
}
get
{
return codigo;
}
}
public char Caracter
{
get
{
return ascii;
}
}
}
I'm making a List<T>, with T being "Variable" but when I add an item to it, it overwrites the last one and also adds one. Basicly what happends is that
//tempVariable = char 'a', double 0.1, int 1 myListT.Add(tempVariable); //now i have an item type "Variable" in my list so I add another one //tempVariable = char 'b', double 0.2, int 1 myListT.Add(tempVariable);//add a second "Variable"
what i have at the end is a list with alot of "variable" with values = char 'a', double '0.2', int 1 in every single value in my list, they all become the last one.

New Topic/Question
Reply




MultiQuote




|