简体   繁体   中英

Datagridview bound to Dictionary in vb.net

I found this: DataGridView bound to a Dictionary

One solution to bind the Datagridview to a Dictionary is the following C# code:

var _priceDataArray = from row in _priceData select new { Item = row.Key, Price = row.Value };

Now I tried this in vb.net using a C# to vb.net converter. The converter gives me the following:

Dim _priceDataArray = From row In _priceDataNew With { _
Key .Item = row.Key, _
Key .Price = row.Value}

However, this doesnt work. Error Message on the with statement: "end-of-statement expected"

Any thoughts?

The conversion should be:

Dim _priceDataArray =
    From row In _priceDataNew
    Select New With {
        Key .Item = row.Key,
        Key .Price = row.Value
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM