在非托管C ++代码中使用C#属性(Use C# properties in unmanaged C++ code)
我们有一个主要用C#编写的大型项目(服务,多线程等)。 但是,核心数字运算算法是用非托管C ++写成的(OpenMP等)。
不幸的是,目前我们不得不在这两个世界之间交换数据。 也就是说,我们必须为每个C ++类在C ++ / CLI中编写包装类。 对于(几乎)在C# - “world”中的任何必需设置(属性),C ++世界中存在一个副本(头文件),并在包装类中来回显式转换。 这种体系结构看起来非常低效且相当容易出错。
主要问题:有没有办法在非托管C ++中自动以某种方式自动共享C#类? (我们必须读写!)
第二个问题:您能否就上述情况提供如何改进架构的建议。 我们的一个考虑是完全切换到C ++,但必须找到合适的库并为我们在.NET中执行的所有(系统)事情编写干净的代码,这一点感觉不好。
非常感谢您的帮助和最诚挚的问候,Jakob
We have a large project mainly written in C# (services, multithreading etc.). However, the core number crunching algorithms are written in unmanaged C++ to be fast (OpenMP etc.).
Unfortunately, at the moment we have to do a lot of effort to exchange data between these two worlds. I.e., we have to write wrapping classes in C++/CLI for each of the C++ classes. For (virtually) any required setting (Properties) in the C#-"world" there is a copy in the C++ world (a header file) and an explicit conversion back and forth in the wrapper class. This architecture seems very inefficient and quite error-prone.
Primary question: Is there a way to share a C#-class with properties somehow automatically in unmanaged C++? (we have to read and write!)
Secondary question: Could you give any advice of how to improve the architecture in a case as described above. One consideration of ours was to completely switch to C++, but having to find appropriate libraries and write clean code for all the (system-)things we do in .NET at the moment does not feel good.
Many thanks for your help and best regards, Jakob
原文:https://stackoverflow.com/questions/10011956
最满意答案
您必须使用选中的属性而不是启用复选框属性。
并且您必须将combobox的enabled属性绑定到checkbox的selected属性。
${!selected}
You have to go with selected property not with enabled property of checkbox.
And you have to bind for combobox's enabled property to checkbox's selected property.
${!selected}
相关问答
更多-
在评估表达式时,如何自定义符号的搜索路径?(How can I customize the search path of symbols when evaluating an expression?)[2019-11-09]
1)你真的需要inherits = FALSE吗? 这样做不然: esub <- function(...) do.call(substitute, list(...)) evalc <- function(expr, env1, env2, env3 = parent.frame()) { eval(esub(esub(expr, env1), env2), env3) } # test env1 <- list2env(list(x = 1, y = 2)) env2 <- list2en ... -
我用谷歌搜索了一下,发现了以下内容: http://www.formdev.com/jformdesigner/doc/ui/beans-binding/ http://forums.netbeans.org/topic1651.html Java Bean,与绑定有关: 什么是JavaBean? 基本上,绑定是具有以下属性的属性:我们有一个源和一个目标,我们想要绑定一个目标属性(来自JTextField的文本,来自JCheckBox的选定状态)和一些源属性(比如一些int值,或一些字符串文本,甚至一个标志 ...
-
你正确的define(SYSTEM_BASEDIR, '/base/dir'); 由于在定义它之前使用常量,因此语法无效。 现在为正则表达式: 打开替换对话框( Ctrl + H ) Find What: define\((\w*), 替换为: define("$1", 这将会变成这样: define(BLA,"test"); 成: define("BLA","test"); You are correct that define(SYSTEM_BASEDIR, '/base/dir'); is inv ...
-
您必须使用选中的属性而不是启用复选框属性。 并且您必须将combobox的enabled属性绑定到checkbox的selected属性。 ${!selected} You have to go with selected property not with enabled property of checkbox. And you have to bind for combobox's enabled property to checkbox's selected property. ${!select ...
-
在projet属性中有一个关于调试会话的选项。 这里可以给gdbinit加载一个文件位置。 对于远程调试会话,该路径必须与远程计算机上的有效.gdbinit匹配。 There is an option about the debug session in the projet properties. Here it is possible to give a file location for the gdbinit to be loaded. For a remote debug session the ...
-
你只需要写if语句,只需要写文本字段的setText,在删除案例中只需要setText =“”.. 希望能帮助到你 you just have to write if statements and just setText of that text field and in the delete case just setText="" .. Hope it helps
-
我不是100%确定可行性,但是要严格回答你的问题,我认为做你想做的“正确”的方法是在自定义插件中注入${project.compileClasspathElements} ,以过滤其内容并在新属性下使自定义类路径可用,然后可以在pom.xml使用并传递给datanucleus插件(设置List类型的属性是我不确定的部分)。 但这听起来像一个丑陋的解决方法, 如果 datanucleus插件存在问题(你没有说明问题究竟是什么),修复datanucleus插件看起来更干净,并且不会花费比编写插件更多的时间来解决 ...
-
我不知道为什么你在插入新记录时让它们为null,但我认为你可以用很多方法解决这个问题。 其中之一 :在Gridview的RowDataBound事件中 protected void gv_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { if (e.Row ...
-
你需要使用一面旗帜。 您可以在此处查看更多信息。 并改为一些预定义的LaF: 可用主题 金属:也称为“跨平台外观”或“海洋主题”。 典型的Java外观 - 这是默认设置。 此类是Java Runtime的一部分,如javax.swing.plaf.metal.MetalLookAndFeel 。 Nimbus:现代的Synth-laf。 此类是Java Runtime 6u10的一部分,如com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel 。 原生:也称为“系统 ...
-
WPF解析绑定表达式(WPF parse binding expression)[2022-11-04]
你要问的是解析MarkupExtension 。 我无法直接找到WPF的实现(它包含在XamlReader.Parse调用链中的某个位置)。 经过一些谷歌搜索后,似乎没有现成的解决方案可以做到这一点。 但是,如果您有编写解析器的经验,则可以自行编写。 解析MarkupExtension的规范在MSDN上给出。 作为一种解决方法,您可以伪装一个控件放在哪里绑定: string myBindingExpression = "{Binding MyProperty}"; var test = "相关文章
更多- 微信C#响应代码
- 基于C#的UDP协议的同步实现
- 谁给推荐一个C++的JSON库
- [转] C#开源项目大全
- C#开发微信公众化平台
- 用C#捕捉键盘和鼠标
- 《C/C++图像处理编程》扫描版[PDF]
- C#开发微信公众平台-就这么简单(附Demo)
- C#开发微信门户及应用(3)--文本消息和图文消息的应答
- C#开发微信公众平台-就这么简单(附Demo)
最新问答
更多- 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
- 如何通过引用返回对象?(How is returning an object by reference possible?)
- 矩阵如何存储在内存中?(How are matrices stored in memory?)
- 每个请求的Java新会话?(Java New Session For Each Request?)
- css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
- 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
- xcode语法颜色编码解释?(xcode syntax color coding explained?)
- 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
- 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
- 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
- 西安哪有PLC可控制编程的培训
- 在Entity Framework中选择基类(Select base class in Entity Framework)
- 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
- 电脑二级VF有什么用
- Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
- 金华英语角.
- 手机软件如何制作
- 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
- 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
- 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
- Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
- 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
- python的访问器方法有哪些
- DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
- 在Ruby中对组合进行排序(Sorting a combination in Ruby)
- 网站开发的流程?
- 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
- 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
- 透明度错误IE11(Transparency bug IE11)
- linux的基本操作命令。。。