Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. MADNESS

MADNESS

Scheduled Pinned Locked Moved XML / XSL
xmlhelpquestion
4 Posts 3 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    eggie5
    wrote on last edited by
    #1

    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

    J 1 Reply Last reply
    0
    • E eggie5

      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

      J Offline
      J Offline
      J Dunlap
      wrote on last edited by
      #2

      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

      E P 2 Replies Last reply
      0
      • J J Dunlap

        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

        E Offline
        E Offline
        eggie5
        wrote on last edited by
        #3

        I've got it under control now... thanks... /\ |_ E X E GG

        1 Reply Last reply
        0
        • J J Dunlap

          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

          P Offline
          P Offline
          Philip Fitzsimons
          wrote on last edited by
          #4

          string filePath = null;


          "When the only tool you have is a hammer, a sore thumb you will have."

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups