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 02:27:06
 
 
To
11/04/2009 17:24:18
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01394360
Message ID:
01394399
Views:
41
Hi Charles,
The first line I got also... but the second.. can't understand ;-(

data.Add(new{Id=id, Name = name})

If List is collection of object.. from where is here "ID" and "Name" ? What means new{Id=... its looks like an array element.. but Id, Name..
So.. I still do't understand a code

Thanks for help
Denis

>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