IntelliSense:没有重载函数的实例 "System::Net::WebHeaderCollection::set" 与参数列表匹配
IntelliSense: no instance of overloaded function "System::Net::WebHeaderCollection::set" matches the argument list
尝试使用方括号语法设置键时...
request->Headers["Accept-Encoding"] = "gzip, deflate";
我收到以下错误:
IntelliSense: no instance of overloaded function "System::Net::WebHeaderCollection::set" matches the argument list
argument types are: (const char [16], const char [14])
object type is: System::Net::WebHeaderCollection ^
显式传入 String^
参数时...
request->Headers[gcnew String("Accept-Encoding")] = gcnew String("gzip, deflate");
我得到:
IntelliSense: no instance of overloaded function "System::Net::WebHeaderCollection::set" matches the argument list
argument types are: (System::String ^, System::String ^)
object type is: System::Net::WebHeaderCollection ^
然而,
request->Headers->Set("Accept-Encoding", "gzip, deflate");
工作正常。那么这是怎么回事?
您的代码的所有三个版本都可以编译 运行,因此这看起来像是一个 Intellisense 错误。我可以使用重载索引器在任何 class 中重现它,其设置器可以采用 Int32 或 String^ 索引参数。我发现 Intellisense 在 C++/CLI 中非常不稳定,所以这可能是您会发现的许多缺陷中的第一个。
考虑将问题报告给 https://connect.microsoft.com/
尝试使用方括号语法设置键时...
request->Headers["Accept-Encoding"] = "gzip, deflate";
我收到以下错误:
IntelliSense: no instance of overloaded function "System::Net::WebHeaderCollection::set" matches the argument list
argument types are: (const char [16], const char [14])
object type is: System::Net::WebHeaderCollection ^
显式传入 String^
参数时...
request->Headers[gcnew String("Accept-Encoding")] = gcnew String("gzip, deflate");
我得到:
IntelliSense: no instance of overloaded function "System::Net::WebHeaderCollection::set" matches the argument list
argument types are: (System::String ^, System::String ^)
object type is: System::Net::WebHeaderCollection ^
然而,
request->Headers->Set("Accept-Encoding", "gzip, deflate");
工作正常。那么这是怎么回事?
您的代码的所有三个版本都可以编译 运行,因此这看起来像是一个 Intellisense 错误。我可以使用重载索引器在任何 class 中重现它,其设置器可以采用 Int32 或 String^ 索引参数。我发现 Intellisense 在 C++/CLI 中非常不稳定,所以这可能是您会发现的许多缺陷中的第一个。
考虑将问题报告给 https://connect.microsoft.com/