Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/319.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
Container.DataItem在C#中工作,而不是在VB.NET中_C#_Asp.net_Vb.net - Fatal编程技术网

Container.DataItem在C#中工作,而不是在VB.NET中

Container.DataItem在C#中工作,而不是在VB.NET中,c#,asp.net,vb.net,C#,Asp.net,Vb.net,这行代码 ((Matches)Container.DataItem).MatchID 在C#中工作,但在VB.NET中,当在中继器中使用时,我会得到错误 “Matches”是一种类型,不能用作表达式 建议?那是因为它是C#而不是VB.NET 我认为VB.NET的强制转换语法类似于: CType(Container.DataItem, Matches).EmpID 但毫无疑问,如果这是错误的,VB.NET专家会插话 DirectCast(Container.DataItem,Matches).

这行代码

((Matches)Container.DataItem).MatchID
在C#中工作,但在VB.NET中,当在中继器中使用时,我会得到错误

“Matches”是一种类型,不能用作表达式

建议?

那是因为它是C#而不是VB.NET

我认为VB.NET的强制转换语法类似于:

CType(Container.DataItem, Matches).EmpID
但毫无疑问,如果这是错误的,VB.NET专家会插话

DirectCast(Container.DataItem,Matches).MatchID

太棒了,杰瑞德。祝你周末愉快!