【发布时间】:2013-03-12 10:23:57
【问题描述】:
有两个项目,一个 C++ CLI 和另一个 C# 项目。
C# 项目中引用了 C++ CLI 程序集。
一切都很好,除了索引属性不起作用。
C++ CLI 代码:
property Nullable< int> PVarInt[System::String^] {
Nullable<int> get(System::String^ inx){
}
void set(System::String^ inx, Nullable< int> newx){
}
}
C# 中的代码显示为两个 set 和 get 方法,如下所示:
get_PVarInt(..)
set_PVarInt(..)
这是一个错误吗?有解决办法吗?为什么会发生这种情况?
【问题讨论】:
-
> 使用这种调用机制,但很少不安全。 System.Diagnostics.Process 进程 = 新 System.Diagnostics.Process(); process.StartInfo.FileName = "App.exe"; process.StartInfo.Arguments = "arg1 arg2 arg3"; process.Start();
-
我写了一篇关于我在将 VB.NET 应用程序转换为 C# 时创建的类的博客文章,它可能对你有用。 PropertyWrapper
-
@JensGranlund 这很有用,谢谢
标签: c# c++ .net visual-c++ c++-cli