尝试创建函数时遇到问题,该函数作为返回类型 (Microsoft.XLANGs.BaseTypes.XLANGMessage) 值的 BizTalk 帮助程序类的一部分。功能代码如下:
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;
}
此代码未构建,因为我收到一条错误消息,指出“使用未分配的局部变量 'outputFile'。我尝试使用 new 关键字 (= new ....) 初始化 'outputFile',但这也会导致构建错误。
我究竟做错了什么?