MADNESS
-
I was building the following code and I get this error, "The call is ambiguous between the following methods or properties: 'string.String(char[])' and 'string.String(sbyte*)'"
FileStream strmSettings; XmlDocument xmlDoc = new XmlDocument(); XmlNode nSetting; string filePath =new String(null); strmSettings = File.Open("options.xml", FileMode.Open); xmlDoc.Load(strmSettings); nSetting = xmlDoc.SelectSingleNode("/options"); if(nSetting != null) filePath = nSetting.InnerText; strmSettings.Close(); string fileName = DateTime.Now.ToString("yyyyMMdd\_hhmm") + ".xml"; XmlTextWriter writer = new XmlTextWriter(filePath + fileName, null);
What does this non sense mean? /\ |_ E X E GG
-
I was building the following code and I get this error, "The call is ambiguous between the following methods or properties: 'string.String(char[])' and 'string.String(sbyte*)'"
FileStream strmSettings; XmlDocument xmlDoc = new XmlDocument(); XmlNode nSetting; string filePath =new String(null); strmSettings = File.Open("options.xml", FileMode.Open); xmlDoc.Load(strmSettings); nSetting = xmlDoc.SelectSingleNode("/options"); if(nSetting != null) filePath = nSetting.InnerText; strmSettings.Close(); string fileName = DateTime.Now.ToString("yyyyMMdd\_hhmm") + ".xml"; XmlTextWriter writer = new XmlTextWriter(filePath + fileName, null);
What does this non sense mean? /\ |_ E X E GG
This is the line that does it:
string filePath =new String(null);
There are many different versions (overloads) of the String constructor, each of which take different arguments. The compiler can't figure out which one to use. Either do:
string filePath = "";
OR
string filePath =new String();
OR
string filePath;
The way you have it, compiler can't figure out whether it's (char)null or (sbyte)null.
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi -
This is the line that does it:
string filePath =new String(null);
There are many different versions (overloads) of the String constructor, each of which take different arguments. The compiler can't figure out which one to use. Either do:
string filePath = "";
OR
string filePath =new String();
OR
string filePath;
The way you have it, compiler can't figure out whether it's (char)null or (sbyte)null.
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi -
This is the line that does it:
string filePath =new String(null);
There are many different versions (overloads) of the String constructor, each of which take different arguments. The compiler can't figure out which one to use. Either do:
string filePath = "";
OR
string filePath =new String();
OR
string filePath;
The way you have it, compiler can't figure out whether it's (char)null or (sbyte)null.
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhistring filePath = null;
"When the only tool you have is a hammer, a sore thumb you will have."