I got an error. Using the unrecognized local variable dictionary, even though I assigned a value in the following code:
private static void UpdateJadProperties(Uri jadUri, Uri jarUri, Uri notifierUri)
{
Dictionary<String, String> dictionary;
try
{
String[] jadFileContent;
using (StreamReader sr = new StreamReader(jadUri.AbsolutePath.ToString()))
{
Char[] delimiters = { '\r', '\n' };
jadFileContent = sr.ReadToEnd().Split(delimiters, System.StringSplitOptions.RemoveEmptyEntries);
}
dictionary = jadFileContent.ToDictionary(x => x.Substring(0, x.IndexOf(':') + 2), x => x.Substring(x.IndexOf(':') + 2));
}
catch (Exception e)
{
Console.WriteLine("The file could not be read:");
Console.WriteLine(e.Message);
}
try
{
if (dictionary.ContainsKey("MIDlet-Jar-URL: "))
{
}
}
catch (ArgumentNullException ane)
{
throw;
}
}
Error from line:
if (dictionary.ContainsKey("MIDlet-Jar-URL: "))
Can someone help me here, pls? TIA
source
share