日期:2014-05-17  浏览次数:20390 次

请教关于返回值的问题,在线等
C# code

 public    HDIP(string hdip)//此处如何来获得hdip的值,因为下一个buttonclick需要用到hdip的值
    {
         try
        {
            string path = HttpContext.Current.Server.MapPath(MachineIpfilepath);
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.Load(path);
            XmlNodeList nodeList = xmlDoc.SelectSingleNode("Machineip").ChildNodes;

            foreach (XmlNode xn in nodeList)
            {
                XmlElement xe = (XmlElement)xn;
                if (xe.Name == "HdCamera")
                {
                    hdip = xe.SelectSingleNode("ip").InnerText.Trim();
                    break;
                }
            }
           
        }
        catch
        {
            
        }
        finally
        {
        } //获得HdCameraIp
         
        

    }



------解决方案--------------------
public void HDIP( out string hdip){....}
------解决方案--------------------
public void HDIP(ref string hdip)

HDIP(ref "asdasd")
------解决方案--------------------
探讨
好像不行哎

C# code


protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
NetInfo.CamIpAddr = //此处需要调用到hdip
}