Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/336.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在C+中定义带有集合参数的公共静态方法+/CX?_C#_Windows 8_Windows Phone 8_Interop_C++ Cx - Fatal编程技术网

C# 如何在C+中定义带有集合参数的公共静态方法+/CX?

C# 如何在C+中定义带有集合参数的公共静态方法+/CX?,c#,windows-8,windows-phone-8,interop,c++-cx,C#,Windows 8,Windows Phone 8,Interop,C++ Cx,如何使用param定义公共静态方法是集合(向量还是映射)? (然后,我需要WP8中的C#来调用此方法) 我写道: public ref class TestClass sealed { public: static void Test(Windows::Foundation::Collections::IVector<int> ^ s); static void Test1(Platform::Collections::Vector<int> ^ s); } publi

如何使用param定义公共静态方法是集合(向量还是映射)? (然后,我需要WP8中的C#来调用此方法)

我写道:

public ref class TestClass sealed
{
public:
static void Test(Windows::Foundation::Collections::IVector<int> ^ s);
static void Test1(Platform::Collections::Vector<int> ^ s);
}
public ref class TestClass密封
{
公众:
静态无效测试(Windows::Foundation::Collections::IVector^s);
静态void Test1(平台::集合::向量^s);
}
然后,Test和Test1都编译错误


错误LNK2001:未解析的外部符号“public:static void\uu cdecl WPRuntimeComponent::delegateTest::Test(结构Windows::Foundation::Collections::IVector^)”(?Test@delegateTest@WPRuntimeComponent@@SAXP$AAU$IVector@H@Collections@Foundati‌​on@Windows@@@Z)


这段代码有两个问题

  • 方法测试没有主体,因此链接器错误

  • 方法Test1是ref类的一个公共方法,这意味着它只能在其签名中使用Windows运行时类型,而此方法的参数类型为Platform::Collections::Vector,它不是正确的Windows运行时类型,但恰好是头文件中定义的本机帮助器类型


  • 您会遇到什么错误?错误LNK2001:未解析的外部符号“public:static void\uu cdecl WPRuntimeComponent::delegateTest::Test(结构Windows::Foundation::Collections::IVector^)”(?Test@delegateTest@WPRuntimeComponent@@SAXP$AAU$IVector@H@Collections@Foundation@Windows@@@Z)重新标记您的问题,以便其他人也能找到它。。。据我所知,您是否提供了该方法的bdy?这里您声明了,但没有定义任何内容。