Answer the question
In order to leave comments, you need to log in
Why is variable not visible outside if in c#?
Good day to all!
There was a problem with the visibility of the variable.
To unserialize an array serialized using PHP, I use the PHPSerializationLibrary library.
Here is the beginning where I connect it
public partial class mainForm : Form
{
public Conversive.PHPSerializationLibrary.Serializer serializer;
public mainForm()
{
InitializeComponent();
serializer = new Conversive.PHPSerializationLibrary.Serializer();
}
}
if (cardsForPrint.Rows[k][20].ToString() == "L")
{
Hashtable ht = (Hashtable)serializer.Deserialize(LParams);
}
newPrintTemplate = newPrintTemplate.Replace("$v67", krest(Convert.ToInt32((string)ht[1])));
Hashtable ht = new Hashtable();
if (cardsForPrint.Rows[k][20].ToString() == "L")
{
ht = (Hashtable)serializer.Deserialize(LParams);
}
Answer the question
In order to leave comments, you need to log in
It's strange that a few days. Learn what the scope of a variable is professorweb.ru/my/csharp/charp_theory/level3/3_5.php.
To fix the problem, just move the variable declaration outside the if
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question