C# 无法识别NameValueCollection中的项

C# 无法识别NameValueCollection中的项,c#,winforms,.net-4.0,C#,Winforms,.net 4.0,我正试图根据这篇文章从代码中设置配置 在这篇文章中,它有以下代码: public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config) { // Get your new connnection string name and then overwrite the base here: config.Item["connectionStrin

我正试图根据这篇文章从代码中设置配置

在这篇文章中,它有以下代码:

public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
{
    // Get your new connnection string name and then overwrite the base here:
    config.Item["connectionStringName"] = "MyNewConnectionStringName";

    base.Initilize(name, config);
}
我的课程是这样的:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using System.Web.Security;
using System.Collections.Specialized;

namespace WebUsers
{
  internal class MembershipOverride : SqlMembershipProvider
  {
    public override void Initialize(string name, NameValueCollection configx)
    {
      // Get your new connnection string name and then overwrite the base here:
      configx.Item["connectionStringName"] = "MyNewConnectionStringName";
      base.Initilize(name, config);
    }
  }
}
我无法获取要识别的项或初始化

它正在这样做:

有人知道我做错了什么吗

我无法获取要识别的项或初始化

有一个打字错误。调用
base.Initilize
而不是
base.InitiAlize

要访问集合元素,请尝试

configx["connectionStringName"] = "MyNewConnectionStringName";

谢谢,这确实解决了Initialize而非item的问题:(@ErocM Updated。请在不使用
的情况下尝试。item