Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help to translate this function from C# to VB
Message
From
12/04/2009 03:28:19
 
 
To
11/04/2009 17:24:18
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01394360
Message ID:
01394400
Views:
41
Ok.. I solve the problem.. it was not too easy as you wrote me.. simple convertion not enough..
there is using Anonymous Type.. which I did knew before.. and the code looks

Dim data As New List(Of Object)()
data.Add(New With {.id = "1", .name = "Denis"})

but.. in any case it does not fix a problem.. as I found - those types are diffrent in C# and VB.NET.. in watch window its not a same view..
:-(


>how about
>
>
>
>   Dim data As New List(Of Object)()
>   data.Add(New ())
>
>
>( I cheated - this is from
>
>http://www.developerfusion.com/tools/convert/csharp-to-vb/
>
>Just wanted to give you the link in case you don't have it. Generally useful.
>
>
>>Hi
>>I study one example code .. and this example written on C#
>>
>>I can't understand how to translate lins to Visual Basic :))
>>
>>
>>List<object> data = new List<object>();
>>data.Add(new{Id=id, Name = name});
>>
>>
>>
>>Here is full source
>>
>>
>>        protected void CitiesRefresh(object sender, StoreRefreshDataEventArgs e)
>>        {
>>            XmlDocument xmlDoc = new XmlDocument();
>>            xmlDoc.Load(HttpContext.Current.Server.MapPath("Cities.xml"));
>>            List<object> data = new List<object>();
>>
>>            foreach (XmlNode cityNode in xmlDoc.SelectNodes(string.Concat("countries/country[@code='", this.Countries.SelectedItem.Value, "']/city")))
>>            {
>>                string id = cityNode.SelectSingleNode("id").InnerText;
>>                string name = cityNode.SelectSingleNode("name").InnerText;
>>
>>                data.Add(new{Id=id, Name = name});
>>            }
>>            this.CitiesStore.DataSource = data;
>>
>>            this.CitiesStore.DataBind();
>>
Previous
Reply
Map
View

Click here to load this message in the networking platform