Hello, I've recently been bitten by the (way too commmon in my opinion) gotcha of Concat returns it's result, rather than appending to the list itself.
For instance.
List<Control> mylist=new List<Control>;
//.... after adding Controls into mylist
MyPanel.Controls.Concat(mylist); //This will not affect MyPanel.Controls at all.
MyPane...
It is convenient for me to use a set. I like how I can "add" ("remove") an element to (from) the set. It is also convenient to check if a given element is in the set.
The only problem, I found out that I cannot add a new element to a set if the set has already such an element. Is it possible to have "sets" which can contain several iden...
In trying to write an API I'm struggling with Scala's collections in 2.8(.0-beta1).
Basically what I need is to write something that:
adds functionality to immutable sets of a certain type
where all methods like filter and map return a collection of the same type without having to override everything (which is why I went for 2.8 in th...
I am reading up the code of the HashMap class provided by the java 1.6 API and unable to fully understand the need of the following operation (found in the body of put and get methods) :
int hash = hash(key.hashCode());
where the method hash() has the following body:
private static int hash(int h) {
h ^= (h >>> 20) ^ (h >>>...
The idea I'm playing with right now is having a multi-leveled "tier" system of analytical objects which perform a certain computation on a common object and then create a new set of analytical objects depending on their outcome. The newly created analytical objects will then get their own turn to run and optionally create more analytical...
...apart from the obvious looping through the list and a dirty great case statement!
I've turned over a few Linq queries in my head but nothing seems to get anywhere close.
Here's the an example DTO if it helps:
class ClientCompany
{
public string Title { get; private set; }
public string Forenames { get; private s...
in my silverlight page I am fetching the data through WCF
WCF is returning an BusinessEntityCollection that is the collection of rows
SqlParameter[] sqlParameter = new SqlParameter[]{new SqlParameter("@recordType",recordType)};
MenuEntity menuEntity;
MenuEntityCollection menuEntityCollection = new MenuEnt...
Hi - I have a problem which I cant seem to find answer to through searches (either that or I am searching for the completely wrong thing!). I have a list of items called "Top 10" in a sortedlist item that is populated from my DB (SortedList where int is position and string is item). I want to be able to move items up & down the list or...
Hi All,
I have an 3 tiered application where I need to get database results and populated the UI.
I have a MessagesCollection class that deals with messages.
I load my user from the database. On the instantiation of a user (ie. new User()), a MessageCollection Messages = new MessageCollection(this) is performed. Message collection accep...
I have two Entities
University
courses
Course
students
i want to access all the students in a university. I tried the following query
select u.courses.students from university u
i got the following exception.
org.hibernate.QueryException: illegal attempt to dereference collection [university0_.id.courses] with element p...
Hi,
I have a problem binding List to a DataGrid element. I've created a class that implements INotifyPropertyChange and keeps list of orders:
public class Order : INotifyPropertyChanged
{
private String customerName;
public String CustomerName
{
get { return customerName; }
set {
customerN...
my issue lokks similar to this one: (link)
but i have one-to-many association:
<set name="Fields" cascade="all-delete-orphan" lazy="false" inverse="true">
<key column="[TEMPLATE_ID]"></key>
<one-to-many class="MyNamespace.Field, MyLibrary"/>
</set>
(i also tried to use )
this mapping is for Template object. this one and the Field...
I have the following nested dictionaries:
Dictionary<int, Dictionary<string, object>> x;
Dictionary<int, SortedDictionary<long, Dictionary<string, object>>> y;
If I do x.Clear() and y.Clear() will all the nested objects clear and all the memory will be reused on the next garbage collection?
Or do I need to iterate on all the items ...
I have a POCO domain model which is wired up to the entity framework using the new ObjectContext class.
public class Product
{
private ICollection<Photo> _photos;
public Product()
{
_photos = new Collection<Photo>();
}
public int Id { get; set; }
public string Na...
I'm writing a custom ASP.NET webcontrol and would like it to have a collection of custom items which can also be specified in the XML markup. Something like this:
class MyControl: WebControl
{
public IList<MyItemType> MyItems { get; private set; }
}
And in the markup:
<asd:MyControl runat="server" id="mc1">
<MyItems>
...
I'm writing a class to represent a Pivot Collection, the root object recognized by Pivot. A Collection has several attributes, a list of facet categories (each represented by a FacetCategory object) and a list of items (each represented by a PivotItem object). Therefore, an extremely simplified Collection reads:
public class PivotCollec...
Hi
s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1]. Is the hash function of the java string, I assume the rest of languages is similar or close to this implementation.
If we have hash-Table and a list of 50 elements. each element is 7 chars ABCDEF1, ABCDEF2, ABCDEF3..... ABCDEFn
If each bucket of hashtable contains 5 strings (I think th...
Hi
No one said that OrderedDictionary is having two copies of elements, one in a hashtable and other in a list, I can't find complexity measurements at MSDN for OrderedList.
thanks
...
Clojure has a very nice concept of transient collections. Is there a library providing those for Scala (or F#)?
...
I'm originally a C# developer (as a hobby), but as of late I have been digging into Ruby on Rails and really enjoying it. Right now I am building an application in C#, and I was wondering if there is any collection implementation for C# that could match (or "semi-match") the find_by method of ActiveRecord.
What I am essentially looking ...