This method is part of a class called OSVersion. When I test this in a console application though it works fine. Count does not exist in the current context. Can anyone shed some light on this please.
public static bool OperatingSystemVersionGet()
{
XmlDocument xlDoc = new XmlDocument();
string sfile =
@"C:\dev\4.6\RTM\R1\Install\SetupManager\SourceCode.SetupManager\SourceCode.SetupManager\Configs\blackpearl\Product.config";
xlDoc.Load(sfile);
XmlNodeList nodeList = xlDoc.SelectNodes("//dependancy");
List<string> compareList = new List<string>();
string osv = Environment.OSVersion.VersionString;
int firstIndex = osv.IndexOf(' ');
int secondIndex = osv.IndexOf(' ', firstIndex + 1);
int thirdIndex = osv.IndexOf(' ', secondIndex + 1);
String osName = osv.Substring(0, thirdIndex);
String majorVersion = osv.Substring(thirdIndex + 1, 1);
String minorVersion = osv.Substring(thirdIndex + 3, 1);
bool isIn = false;
if (nodeList != null)
foreach (XmlNode node in nodeList)
{
try
{
string type = node.Attributes["type"].Value;
string name = node.Attributes["name"].Value;
string feat = node.Attributes["featureversion"].Value;
String[] versionPart = feat.Split('.');
string second = versionPart[1];
string third = versionPart[2];
if (type == "Windows")
{
if((name == osName) && ((second == majorVersion) && (third == minorVersion)))
{
compareList.Add(name);
}
}
}
catch(NullReferenceException ex)
{
//nullReferenceException handled here
}
}
if(compareList.Count == 0)
{
isIn = true;
}
else
{
isIn = false;
}
return isIn;
}
you say that you receive this in compile time
try to clean your solution and rebuild it .
I can’t see any error and I made a copy of your function in my current project and I compile it without error !