Does .NET have anything similar to Perl arrays, which are indexed numerically but automatically expand as needed? It would work like this:
var x = new DreamArray<string>();
x[6] = "foo"; // x automatically has 7 elements
x[10] = "bar"; // now it has 11
...
I'm writing a cache-eject method that essentially looks like this:
while ( myHashSet.Count > MAX_ALLOWED_CACHE_MEMBERS )
{
EjectOldestItem( myHashSet );
}
My question is about how Count is determined: is it just an internal int, or is it calculated by counting the elements each time its called?
...
I have a Person class which has a String collection of aliases representing additional names that person may go by. For example, Clark Kent may have aliases "Superman" and "Man of Steel". Dwight Howard also has an alias of "Superman".
@Entity
class Person {
@CollectionOfElements(fetch=FetchType.EAGER)
Set<String> aliases = new Tr...
I had a performance problem today that showed up after some profiling. Calls to List<>.RemoveAt(0) were taking a long time. I'd assumed System.Collections.Generic.List would be implemented with a list data structure, but actually its implemented as an array.
Does anyone else find that surprising?
...
I want a collection in Java which:
maps arbitrary Objects to Objects (not String or otherwise restricted keys only)
will be used as a cache; if the key is not in the cache, a value will be computed (this doesn't have to be built into the collection)
will be accessed from multiple threads simultaneously
will never have items removed fro...
Hi All,
I'm working on an application that does processing at what I'd call fairly high throughput (current peaks in the range of 400 Mbps, design goal of eventual 10 Gbps).
I run multiple instances of a loop which basically just cycles through reading and processing information, and uses a dictionary for holding state. However, i als...
Hello all,
Lets assume I have the following 3 entities: Customer,Order,Product which interact in the View with the CustomerOrderProductViewModel.cs:
I have several controls like listbox,datagrid,etc.. to display those entities in my View.
Those Entities shall be fetched sort of eager loading. That would mean I have 3 sqldatareader in ...
I have a list of key/value pairs (probably will be using a SortedList) and I won't be adding new values.
Instead I will be using new keys to get bounding values. For example if I have the following key/value pairs:
(0,100) (6, 200), (9, 150), (15, 100), (20, 300)
and I have the new key of 7, I want it to return 200 and 150, beca...
I find myself in a situation where I'm not sure which Collection would best suit my needs.
I have a series of task objects that will be used in the following manner...
The tasks will execute repeatedly during the application's runtime.
The tasks will execute in a specific order based on the priority I assign each of them. (I don't c...
Hi,
I'm having an entity object called Patient and this entity is having a property called Visits which is of type VisitsCollection.
VisitsCollections is a child class of IList<Visit> but it also adds some custom logic to the collection (like auto ordering, some validation, notifications, etc..).
I need to use the custom collection ty...
This does not compile.
Dim Tom As New List(Of String) = {"Tom", "Tom2"}
This does
Dim Tom As String() = {"Tom", "Tom2"}
IMO this features should be allowed for all collection types and not only arrays.
...
is whole Hashtable object is syncronized?
I Know,Get and Put methods are synchronized.
Is it mean, each entries in the Hashtable are synchronized?
If i have a hash object hsObj, and have 3 key-value pairs "a->sun" "b->tue" and "c->wed"
then while getting one entry values we can put other entry values but we cant put or get at the same e...
I want to create an implementation of the IDictionary(Of TKey, TValue) interface to provide some wrapper functionality.
Public Class ExtendedDictionary(Of TKey, TValue)
Implements IDictionary(Of TKey, TValue)
Private _Dictionary As Dictionary(Of TKey, TValue)
Public Sub Add(ByVal key As TKey, ByVal value As T) Implements I...
I'm writing a game in Flash (player 10) and need to come up with a good way to manage the list of objects/entities/actors in the game (player character, obstacles, enemies, etc.). It has these requirements:
Iterable
Objects addable and removable while iterating.
Argument to remove() function would be the object to remove, not an index...
How would you to convert or cast a List<T> to EntityCollection<T>?
Sometimes this occurs when trying to create 'from scratch' a collection of child objects (e.g. from a web form)
Cannot implicitly convert type
'System.Collections.Generic.List' to
'System.Data.Objects.DataClasses.EntityCollection'
...
The .NET Framework contains since version 3.0 the ObservableCollection<T>, but why isn´t there a ObservableKeyedCollection<TKey, TValue>.
Okay i could implement my own collection by deriving from KeyedCollection<TKey,TValue> and implementing the INotifyCollectionChanged interface, but whouldn´t it be a good addition to the .NET Framewor...
I have a List of User objects from my data store.
Now once it is already in memory the only way to get a user by his ID is to use the Single extension method. This is really performance degrading.
I know I could have used a dictionary instead of a list but this would be redundant. I would have to store the Primary Key 2 times. So is t...
Is the decision by Google similar to the one for SortedMultiSet (stackoverflow question)
or is it because there is no use of MultiKeyMap?
I am aware that an alternate for MultiKeyMap can be to use a custom Class as a key which contains the multiple keys as its class members. On the contrary, I like the concept of specifying multiple keys...
I have a List of HashMap such as below
ArrayList l = new ArrayList ();
HashMap m = new HashMap ();
m.add("site_code","AL");
m.add("site_name","Apple");
l.add(m);
m = new HashMap();
m.add("site_code","JL");
m.add("site_name","Cat");
l.add(m);
m = new HashMap();
m.add("site_code","PL");
m.add("site_name","Banana");
l.add(m)
I'd like to ...
Is there a way to get all the querystring name/value pairs into a collection?
I'm looking for a built in way in .net, if not I can just split on the & and load a collection.
...