3

I'm working on a VB.NET to C# conversion and I'm currently stuck with a TreeView object.

Dim Arguments1 As String = path & "\" & fs & " ls " & TreeView1.Nodes(ccc).Name

So far, I can only get to this:

string Arguments1 = path + "\\" + fs + " ls " + ?

IN VB.NET, TreeView has a method, Nodes(int), which I can get the Name property from. However, C# doesn't have a Nodes(int) method. I think it might be TreeView1.Items[ccc], but TreeView1.Items[ccc].Name doesn't compile because the object Items[int] returns doesn't contains a Name property. How do I get it?

4

1 に答える 1

4

プロパティを持つWPFのコードを持つプロパティを持つWinForms 用に書かれたコードを翻訳しているようです。プロパティを取得するには、戻り値を a にキャストする必要があります。C# コードは次のようになります。TreeViewNodes TreeViewItemsTreeViewItemName

string Arguments1 = path + "\\" + fs + " ls " + ((TreeViewItem)TreeView1.Items[ccc]).Name
于 2012-04-29T00:41:13.587 に答える