无法从 Vb.net 获得 C# 等价物
Trouble getting the C# Equivalent from Vb.net
我已经尝试了所有我能想到的方法来获得等效的 c#,但我就是不知道发生了什么,也不理解语法。
For Each c As Control In pnlThumbs.Controls
If Not IsNothing(c.Tag) Then
Dim GUID As String = CStr(CType(c.Tag, Object())(0))
End If
Next
我遇到的问题是在 C# 中以相同的方式获取字符串 GUID
。
为什么不使用 Online converter 之类的东西呢?它会告诉您 C# 中的等效代码是:
foreach (Control c in pnlThumbs.Controls)
{
if ((c.Tag != null))
{
string GUID = Convert.ToString((object[])c.Tag(0));
}
}
EDIT:看来这次 Telerik 转换器失败了。可以使用另一个 online converter:
找到正确答案
foreach (Control c in pnlThumbs.Controls)
{
if ((c.Tag != null))
{
string GUID = Convert.ToString((object[])c.Tag[0]);
}
}
我已经尝试了所有我能想到的方法来获得等效的 c#,但我就是不知道发生了什么,也不理解语法。
For Each c As Control In pnlThumbs.Controls
If Not IsNothing(c.Tag) Then
Dim GUID As String = CStr(CType(c.Tag, Object())(0))
End If
Next
我遇到的问题是在 C# 中以相同的方式获取字符串 GUID
。
为什么不使用 Online converter 之类的东西呢?它会告诉您 C# 中的等效代码是:
foreach (Control c in pnlThumbs.Controls)
{
if ((c.Tag != null))
{
string GUID = Convert.ToString((object[])c.Tag(0));
}
}
EDIT:看来这次 Telerik 转换器失败了。可以使用另一个 online converter:
找到正确答案foreach (Control c in pnlThumbs.Controls)
{
if ((c.Tag != null))
{
string GUID = Convert.ToString((object[])c.Tag[0]);
}
}