【发布时间】:2015-09-10 08:26:50
【问题描述】:
使用转换器(Redgate,Telerik,...)后,我无法将此表达式 c# 转换为 vb.net
if (afterItemRemoved != null)
{
cacheItemPolicy.RemovedCallback = x => afterItemRemoved(
x.CacheItem.Key,
(T)x.CacheItem.Value);
}
我尝试了以下表达式但没有成功(Reflector 8.5 de RedGate y converter.telerik.com)
If (afterItemRemoved IsNot Nothing) Then
cacheItemPolicy.RemovedCallback = x => afterItemRemoved.Invoke(x.CacheItem.Key, DirectCast(x.CacheItem.Value, T))
End If
If afterItemRemoved IsNot Nothing Then
cacheItemPolicy.RemovedCallback = Function(x) afterItemRemoved(x.CacheItem.Key, DirectCast(x.CacheItem.Value, T))
End If
【问题讨论】:
-
你尝试过的看起来与原来的完全不同。为什么您尝试的函数名称不同?
-
是两个类似的方法,是转录错误。感谢您的评论。
-
将“!=”(C#)转换为“>”(VB.NET)的工具肯定不是太有用。
-
这很奇怪,你是对的。
标签: c# vb.net lambda expression