Questions tagged [enumeration]

The process of enumerating values, for example from some collection.

Use for enumeration types.

1894 questions
0
votes
1 answer

Does a Where followed by OrderBy require ToList and lock to prevent collection was modified exception?

I have the following code: lock (fullEventList) { ftl = fullEventList.Where(a => a != null) .OrderBy(a => a.Start) .ThenBy(a => a.TaskID) .ThenBy(a => a.Status).ToList(); } An…
Stephen Price
  • 1,629
  • 1
  • 24
  • 42
0
votes
1 answer

Change a property with the element itself in a list of dictionaries with list comprehension

Okay, so you can change an element in a list with simple number values this way: >>> a=[1,2,3,4,5,1,2,3,4,5,1] >>> for n,i in enumerate(a): ... if i==1: ... a[n]=10 ... >>> a [10, 2, 3, 4, 5, 10, 2, 3, 4, 5, 10] and with list…
MattSom
  • 2,097
  • 5
  • 31
  • 53
0
votes
0 answers

SerializableEnumeration is not excepting vector

I have a SerializableEnumeration and I am trying to add a vector elements into that SerializableEnumeration. Below is the code. if(objTempVector !=null) { CommonUtils.log("objTempVector::::::::::::::::::::::…
Sunil
  • 102
  • 1
  • 5
  • 19
0
votes
0 answers

Binding Different Enumerations in Scala

Scenario: I have two Enumerations type: Schema and Table. I want to bind every Table to a Specific Schema. So, actually I have implemented this: object Table extends Enumeration { type Tabella = Value val TABLE1 = Value("TABLE1") val TABLE2…
Tizianoreica
  • 2,142
  • 3
  • 28
  • 43
0
votes
2 answers

Iterate Array and Count Changes from Negative to Positive (and vice versa)

I'm using CoreMotion's GyroData to determine the Z direction of the devise's movement. This returns me an array of doubles. Positive moving forward, negative moving backwards. I'd now like to count how many times the devise moves in one direction.…
robinyapockets
  • 363
  • 5
  • 21
0
votes
1 answer

C enumeration not returning a value that is not specified

I'm creating a program to separate nonterminals from terminals for a programming language. An enumerator keeps track of the tag names for the nonterminals. The nonterminal ID is set as 0 and all others enumerate after (as it should). However, when…
Sora
  • 87
  • 1
  • 8
0
votes
4 answers

Adding missing Enumerations into the list C#

I have written a following code which basically groups my sales by days and then I show them to users on graph like following: var DailyGraph = userStores.ToList().GroupBy(x => x.TransactionDate.Value.DayOfWeek).Select(pr => new { Day =…
User987
  • 3,663
  • 15
  • 54
  • 115
0
votes
0 answers

What is the difference between enumerations (Not IEnumerables) and arrays?

I'm learning about enumerations and I'm trying to understand what is the difference between enumerations and arrays. I've been googling online but haven't quite found any solid answers for this question that's been boggling me. They both seem quite…
Quenta221
  • 21
  • 4
0
votes
1 answer

Sort Array of Struct Arrays [Array][Struct]

I have a 3D array that is built via a an enumerated for loop that performs a background query of local SQL Lite table. 99% of the time everything is in order. 1% of the time things get a bit out of sequence. As the code to perform the background…
WanderingScouse
  • 281
  • 1
  • 3
  • 16
0
votes
2 answers

Get any enum from ComboBox

I'm programming in WPF(C#). I populate a ComboBox with this function: public static void PopulateComboBox(ComboBox cmb, Type type) { foreach (string name in Enum.GetNames(type)) { cmb.Items.Add(name); } } Now I need a method…
Babak.Abad
  • 2,839
  • 10
  • 40
  • 74
0
votes
5 answers

Array Trouble in C#

I'm trying to get the contents of an array to display but all that happens is this prompt namespace ConsoleApp { class Program { static void Main(string[] args) { string[] values = { "This", "That", "The Other…
Justin
  • 357
  • 2
  • 7
  • 18
0
votes
1 answer

Changing a collection.Counter during enumeration?

counter = Counter() // fill data into counter for a, b in counter.most_common(): if (b > 1): counter[a] = np.log(b) else: counter[a] = -np.log((1 / (b+0.01))) As I see, this is safe, based on my trial. No bad thing happens…
Infinite Possibilities
  • 7,415
  • 13
  • 55
  • 118
0
votes
1 answer

Does NUnit provide a multiple enumeration helper?

In my company code base we have a bunch of extension method for IEnumerable object. Some of this method enumerate multiple time the parameter given in entry. Of course, we don't want the so I'm going to fix those methods. But first I would like to…
Orace
  • 7,822
  • 30
  • 45
0
votes
0 answers

Removing from set during enumeration in Swift?

Is it safe to delete an element from a set during enumeration? for item in mySet { ... if needToRemove { mySet.remove(item) } }
Ilya
  • 1
  • 2
0
votes
1 answer

CPLEX Enumerate All Possible Optimal Solutions

I have solved an optimization problem in CPLEX, but now that I have the optimal solution. I would like to know if there are other optimal solutions. Is is possible to enumerate all other solutions in CPLEX. Thanks
user2058291
  • 107
  • 3
  • 10