CodeConditionStatement 和 Nullable.Equals
我必须通过 C# CodeConditionStatement 创建以下 VB.Net 代码
If Not Nullable.Equals(field.Name, Value) Then
...
End If
我已经尝试过
var property = new CodeMemberProperty();
CodeExpression condition = new CodeMethodInvokeExpression(System.Nullable,"Equals", new CodeExpression(){
new CodeVariableReferenceExpression(field.Name),
new CodePropertySetValueReferenceExpression()
});
property.SetStatements.Add(new CodeConditionStatement(condition, null));
但 System.Nullable
无法在 CodeExpression 中转换。
I have to create the following VB.Net code through a C# CodeConditionStatement
If Not Nullable.Equals(field.Name, Value) Then
...
End If
What I alredy tried was
var property = new CodeMemberProperty();
CodeExpression condition = new CodeMethodInvokeExpression(System.Nullable,"Equals", new CodeExpression(){
new CodeVariableReferenceExpression(field.Name),
new CodePropertySetValueReferenceExpression()
});
property.SetStatements.Add(new CodeConditionStatement(condition, null));
but a System.Nullable
can't be converted in a CodeExpression.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
所以这似乎有效:
非常糟糕但有效......
如果有人有更好的主意:D
So this seems to work:
pretty awful but working.....
If someone has a better idea :D