Questions tagged [custom-collection]

19 questions
28
votes
3 answers

Custom Collection using IEnumerable vs ICollection vs IList

I need to design my own custom GenericCollection class. Now i have plenty of options to derive it using IEnumerable, ICollection, and IList, where later offers some added functionalities. I am little confused that if i go with IEnumerable i might…
Furqan Safdar
  • 16,260
  • 13
  • 59
  • 93
27
votes
2 answers

Bug with For Each enumeration on x64 Custom Classes

I have found a bug in VBA a few months ago and was unable to find a decent workaround. The bug is really annoying as it kind of restricts a nice language feature. When using a Custom Collection Class it is quite common to want to have an enumerator…
Cristian Buse
  • 4,020
  • 1
  • 13
  • 34
12
votes
4 answers

UICollectionView with different cell size

My goal is to create a UICollectionView with a layout as depicted below. Is this possible without creating a custom UICollectionViewLayout?
Ujesh
  • 1,698
  • 2
  • 23
  • 35
3
votes
1 answer

How to implement a custom typesafe collection using generic collections?

I used a strongly typed collection that derived from the CollectionBase class and now I'd like to change it to inherit from a typesafe generic collection. Some advise to inherit from List, some do advise to use Collection. What I'd like to do…
1
vote
1 answer

Is there a PropertyGrid Collection Editor "Add" button event or override?

Is there an event or a function that is triggered when the Windows Forms PropertyGrid Collection Editor "Add" button is clicked? (see image) I'd like to add some custom code to run when this button is pressed. I use a custom collection for a list of…
1
vote
0 answers

Implement method of collection .add using only iterator

I must implement all methods of collection using iterator only. My iterator: class CustomIterator implements Iterator { private int index; @Override public boolean hasNext() { return index < data.size(); …
Valeriu
  • 171
  • 1
  • 1
  • 11
1
vote
1 answer

Create a custom user collection of collections

I need to create a generic collection of generic collections, that should contain a generic class. I've tried hard, but haven't found any answers.This is how my realizated collection looks like:…
0
votes
1 answer

Custom Collection extending on Set in Scala

This is a follow-up on the below question: How to create a custom collection that extends on Sets In Scala? I have a basic class that extends on the Set collection and most of the functions like filter, collect and others are working : import…
Usr654789
  • 47
  • 6
0
votes
1 answer

How to create a custom collection that extends on Sets In Scala?

I want to create a new custom Scala collection from existing Set Collection which I can later extend with some additional functions. For the moment, I am trying to make it behave as the standard collection Set. I tried the following link :…
Usr654789
  • 47
  • 6
0
votes
1 answer

Prometheus counter not yielding in custom collector

I am writing this custome collector where I want to add a counter. #!/usr/bin/env python3 import sys import time from prometheus_client import start_http_server from prometheus_client.core import CollectorRegistry, Counter class MyCollector(): …
dganesh2002
  • 1,917
  • 1
  • 26
  • 29
0
votes
1 answer

UICollectionView with dynamically-scaling cells

My goal is to create a layout presented below: I know how to create these custom UICollectionViewCells, but I trouble with the layout. All of the shown cells differ in width, so there can be, for instance: four in the first row, two in the second,…
wictorious
  • 851
  • 3
  • 10
  • 24
0
votes
1 answer

c# XML de-serialisation

Pulling out my hair again. I've spent all day looking at this and can't figure out if its possible or not, or what i'm doing wrong. I've created a custom object collection. public class ObjectCollection : IEnumerable, IEnumerable where T :…
Stuie_M
  • 122
  • 11
0
votes
1 answer

How to turn ObservableCollection as wrapper collection to keep track of the changes?

I think it's fairly simple question but I am still unable to find any better solution for it. So after researching on this subject, I thought to ask this question here to have an expert opinion. Basically, I am working on WPF application and I have…
Furqan Safdar
  • 16,260
  • 13
  • 59
  • 93
0
votes
2 answers

Custom collection in swift: is it a right way?

I am learning swift. I would like to use a custom class to be loopable [able to a for...in loop] like Array. Below is the given sample code that so far, I have tried. The class in question is "GuestManager" which is holding a private collection of…
user2788672
  • 245
  • 4
  • 15
0
votes
1 answer

After Deserialization using DataContractSerializer, Collection gets read-only

This should be pretty straight forward but after deserializing my business objects using DataContractSerializer all the custom collections inside them turned to read-only. To be exact i am trying to manipulate the collection after deserialization by…
1
2