C# 3.0 错误C#.NET 3.0:与';CreatePageSection(参考字符串、参考字符串、参考对象)和#x27;有一些无效的参数

C# 3.0 错误C#.NET 3.0:与';CreatePageSection(参考字符串、参考字符串、参考对象)和#x27;有一些无效的参数,c#-3.0,C# 3.0,我有以下问题。我遇到了一个关于默认参数的错误。我为重载添加了一段简单的代码。现在我进入新代码(第3行:CreatePageSection(sItemID,“,null);)给出了标题中提到的错误 我在其他主题中寻找答案,但我找不到问题所在。有人能帮我吗 代码可在此处找到: public void CreatePageSection(ref string sItemID) { CreatePageSection(sItemID, "", null); } publ

我有以下问题。我遇到了一个关于默认参数的错误。我为重载添加了一段简单的代码。现在我进入新代码(第3行:CreatePageSection(sItemID,“,null);)给出了标题中提到的错误

我在其他主题中寻找答案,但我找不到问题所在。有人能帮我吗

代码可在此处找到:

public void CreatePageSection(ref string sItemID)
    {
        CreatePageSection(sItemID, "", null);
    }

public void CreatePageSection(ref string sItemID, ref string sFrameUrl, ref object vOnReadyState)
    {

        if (Strings.InStr(msPresentPageSections, "|" + sItemID + "|", 0) > 0) {
            return;
        }
        msPresentPageSections = msPresentPageSections + sItemID + "|";

        string writeHtml = "<div class=" + MConstants.QUOTE + "PageSection" + MConstants.QUOTE + " id=" + MConstants.QUOTE + "Section" + sItemID + "Div" + MConstants.QUOTE + " style=" + MConstants.QUOTE + "display: none;" + MConstants.QUOTE + ">";
        this.WriteLine_Renamed(ref writeHtml);
        //UPGRADE_WARNING: Couldn't resolve default property of object vOnReadyState. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        //UPGRADE_NOTE: IsMissing() was changed to IsNothing_Renamed(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="8AE1CB93-37AB-439A-A4FF-BE3B6760BB23"'
        writeHtml = "  <iframe id=" + MConstants.QUOTE + sItemID + "Frame" + MConstants.QUOTE + " name=" + MConstants.QUOTE + sItemID + "Frame" + MConstants.QUOTE + " frameborder=" + MConstants.QUOTE + "0" + MConstants.QUOTE + (!string.IsNullOrEmpty(sFrameUrl) ? " src=" + MConstants.QUOTE + sFrameUrl + MConstants.QUOTE : "") + ((vOnReadyState == null) ? "" : " onreadystatechange=" + MConstants.QUOTE + Convert.ToString(vOnReadyState) + MConstants.QUOTE) + ">";
        this.WriteLine_Renamed(ref writeHtml);
        writeHtml = "  </iframe>";
        this.WriteLine_Renamed(ref writeHtml);
        writeHtml = "</div>";
        this.WriteLine_Renamed(ref writeHtml);

    }
public void CreatePageSection(参考字符串sItemID)
{
CreatePageSection(sItemID,“,null);
}
公共void CreatePageSection(引用字符串sItemID、引用字符串sFrameUrl、引用对象vOnReadyState)
{
if(Strings.InStr(msPresentPageSections,“|”+sItemID+“|”,0)>0){
返回;
}
msPresentPageSections=msPresentPageSections+sItemID+“|”;
字符串writeHtml=“”;
此.WriteLine_已重命名(ref writeHtml);
//升级\u警告:无法解析对象vOnReadyState的默认属性。单击以获取详细信息:“ms”-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword=“6A50421D-15FE-4896-8A1B-2EC21E9037B2”
//升级注意:IsMissing()已更改为IsNothing\u重命名()。单击了解更多信息:“ms”-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword=“8AE1CB93-37AB-439A-A4FF-BE3B6760BB23”
writeHtml=“”;
此.WriteLine_已重命名(ref writeHtml);
writeHtml=“”;
此.WriteLine_已重命名(ref writeHtml);
writeHtml=“”;
此.WriteLine_已重命名(ref writeHtml);
}

由于您没有操作
sFrameUrl
vOnReadyState
,请从这些参数中删除
ref
关键字

见:


Mario

您必须通过引用传递参数

public void CreatePageSection(ref string sItemID)
{
    var missingString = String.Empty;
    object missingObject = null;
    CreatePageSection(ref sItemID, ref missingString, ref  missingObject);
}