unassigned use of local variable q

  • Thread starter Thread starter Eric Sabine
  • Start date Start date
E

Eric Sabine

I just need to understand this bit. In some code, I had the following give
me an error at build time

XmlDocument xmlDoc;
xmlDoc.LoadXml(xmlString);

The error was "unassigned use of local variable" on the second line at
xmlDoc

I ammended the first line to include " = null" and it compiled fine. Could
someone more knowledgeable explain why the =null was explicitly required?

Eric
 
Back
Top