【发布时间】:2008-11-03 00:41:07
【问题描述】:
在尝试创建函数时遇到问题,该函数作为 BizTalk 帮助程序类的一部分返回类型 (Microsoft.XLANGs.BaseTypes.XLANGMessage) 的值。功能代码如下:
public XLANGMessage UpdateXML (XLANGMessage inputFile)
{
XmlDocument xDoc = new XmlDocument();
XLANGMessage outputFile;
xDoc = (System.Xml.XmlDocument) inputFile[0].RetrieveAs(typeof(System.Xml.XmlDocument));
// Modify xDoc document code here
outputFile[0].LoadFrom(xDoc.ToString());
return outputFile;
}
此代码未构建,因为我收到一条错误消息“使用未分配的局部变量 '输出文件'。我尝试使用 new 关键字 (= new ....) 初始化“outputFile”,但这也会导致构建错误。
我做错了什么?
【问题讨论】: