vb.net - Generic Collections -


Text after "div class =" itemprop = "text">

In VB6, there is a collection data type that would either allow its owner to retrieve an item in the archive Although it was or successive, it was not typed strongly.

Now, with VB.Net, I am looking for a suitable replacement which type strongly and can be used with a general archive.

This is a simple example of what I want to do. The only problem is that the built-in storage class does not support the efficient retrieval of an item by the binding list, an alpha key, so I get the item To do this I have to loop through the elements which I am looking for. For larger collections, it is not efficient.

I have seen various collection type sections though and they have not got any suitable replacement

This is what I want to do, except for the looping done with item property .

Instead of just saying "use the hash tables" or something like that, if you could include the outside, expanded as I have done for less example below.

Public class car public sub-new (ByVal keyName string, as inVilue property1 as string) _KeyName = keyName _Property1 = property1 End sub-dim_KeyName string public property KeyName () string form In the form of the return _KeyName termination set as) (byVal value as string) _KeyName = value ending set end property public _Property1 string as public property property1 (go go string return _Property1 close Get set go (set value as ByVal value) _Property1 = value ending property end class public class car acquisition System.ComponentModel.BindingList (car's) public overloads re-adOnly property item (as ByVal key string) Go to the car as every CurrentCar. Me.Items then CurrentCar.KeyName = Key then Return CurrentCar End then the next return anything end Get Termination Property Termination Class < P>

I believe you are looking for String, car & gt; In fact, your own collection class is strongly typed and if you want to dictionary & lt do not change the class of your parents, (self) is normal, you do You must be ready at all. Surely all of this assume that you add cars to the collection with a string key. If you want a lookup based on the value of a property in the collection, you can do better either by clicking the list & lt; Cars & gt; Receive or inherit from and use LINQ to ask the list. After this you may have ...

  Public Overloads ReadOnly Get the item item (as ByVal key string) in the form of a car (from C in me where c.KeyName = key C) .SingleOrDefault () Get End End Growth Property  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -