Possible Duplicate:
Container Class / Library for C
We have to maintain and even develop C-code of our legacy system. Is there good collection library that would support Java/C# (new versions) style collections. Hashtable, HashSet, etc. Of course without objects, but with structs. The HashTable key limitations to "strings" and...
I'm relatively new to WPF, and I'm having trouble with what I'm fairly certain is a relatively simple problem.
I have my underlying data object, a Person:
class Person
{
public string Surname {get; set; }
public string Firstname {get; set; }
public List<Address> Addresses {get; }
}
And I wish to display and edit this obje...
I have a method which needs a Comparator for one of its parameters. I would like to pass a Comparator which does a normal comparison and a reverse comparator which does in reverse.
java.util.Collections provides a reverseOrder() this is good for the reverse comparison, but I could not find any normal Comparator.
The only solution what ...
I have a method that returns an instance of
Map<String, List<Foo>> x();
and another method that returns an instance of
Map<String, Collection<Foo>> y();
Now if I want to dynamically add one of this Maps in my field, how can I write the generics for it to work?
ie:
public class Bar {
private Map<String, ? extends Collection<...
In .NET 3.5 List<> gains a ForEach method. I notice this does not exist on IList<> or IEnumerable<> what was the thinking here? Is there another way to do this? Nice and simple short way to do this?
I ask because I was at a talk where the speaker said always use the more general interfaces.
But why would I use IList<> as a return type i...
If an object holds a unique primary key, what interfaces does it need to implement in order to be collection friendly especially in terms of being efficiently sortable, hashable, etc...?
If the primary key is a string, how are these interfaces best implemented?
Thanks!
...
I'm trying to store types in a collection, so that i can later instantiate objects of the types in the collection. But I'm not sure how to do this the best way.
What i have so far:
List<Type> list = new List<Type>();
list.Add(typeof(MyClass));
var obj = (MyClass)Activator.CreateInstance(list[0]);
I would like to have some constrains ...
I've encountered a strange problem while upgrading an application from Silverlight 3.0 to Silverlight 4.0. The XAML below used to work fine but after upgrading no longer works.
<xxx:FeatureGrid.Columns>
<agDataGrid:AgDataGridColumnCollection>
<xxx:FeatureGridTextColumn FieldName="HOUSE_NUM" HeaderContent="Number" />
...
How would you sort a scala.collection.Map[java.lang.String, Int] by its values (so on the Int)? What is a short and elegant way to do that?
...
I want to add a key,value pair into a hashtable (or any other collection) but have to maintain insertion order. How can I do this?
Like I'll add 1 as key "one" as value, 2 as key and "two" as value.
The output should be ordered as:
1:one
2:two
...
I have a question about a class I created that is similar to the ObserverableCollection. My class basically has the same same functionality as it, but I add some automatic sorting features to it when items are added to the List. My question is my class implements the interface INotifyCollectionChanged so that the ListView, which displays...
I was wondering which type would have better performance and which you think should be used.
For example I have a List of strings not knowing how many items I will need so having the .Add(String) function is really convenient. I can Add new strings to the list at any time easily.
What are the advantages/disadvantages of using each?
A...
I suspect I'm not looking at this issue in the right way so here goes.
I have essentially a LinkedList of data on a web page (http://en.wikipedia.org/wiki/Linked_list) that I'd like to manipulate using traditional Linked List behavior (i.e. just updating the reference/id of the "next" object) for performance reasons.
Where this gets ...
I am wondering what the rationale is behind having Java's Map.put(key, value) method overwrite equivalently key'd values that are already in the collection, while Set.add(value) does not overwrite a pre-existing equivalent value that is already in the collection?
Edit:
It looks like majority viewpoint is that objects in a set that eval...
What is the standard nowadays when one needs a thread safe collection (e.g. Set).
Do I synchronize it myself, or is there an inherently thread safe collection?
...
I’m currently learning the Java Collections API and feel I have a good understanding of the basics, but I’ve never understood why this standard API doesn’t include a Graph implementation. The three base classes are easily understandable (List, Set, and Map) and all their implementations in the API are mostly straightforward and consiste...
Is there some method in ICollection in C# that would add all elements of another collection?
Right now I have to always write foreach cycle for this:
ICollection<Letter> allLetters = ... //some initalization
ICollection<Letter> justWrittenLetters = ... //some initalization
... //some code, adding to elements to those ICollections
forea...
Hi All,
I am trying to fix the size of the Hashtable with following code.
Hashtable hashtable = new Hashtable(2);
//Add elements in the Hashtable
hashtable.Add("A", "Vijendra");
hashtable.Add("B", "Singh");
hashtable.Add("C", "Shakya");
hashtable.Add("D", "Delhi");
hashtable.Add("E...
Hi ,
i have 2 entities : ( person ) & (Address)
with follwing mapping :
<class name="Adress" table="Adress" lazy="false">
<id name="Id" column="Id">
<generator class="native" />
</id>
<many-to-one name="Person" class="Person">
<column name="PersonId" />
</many-to-one>
</class>
<class name="Person" table="Pe...
I've got some code that creates a list of AD groups that the user is a member of, with the intention of saying 'if user is a member of GroupX then allow admin access, if not allow basic access'.
I was using a StringCollection to store this list of Groups, and intended to use the Contains method to test for membership of my admin group, ...