problem about ienumerable-Collection of common programming errors


  • Ken
    c# exception ienumerable wrapper
    I’ve got a bunch of classes that can Process() objects, and return their own objects:public override IEnumerable Process(IEnumerable incoming) { … }I want to write a processor class that can wrap one of these processors, and log any uncaught exceptions that the wrapped Process() method might throw. My fir

  • Brian Evans
    .net ienumerable
    I have a WebAPI with the following model:public class Dog {public string name { get; set; }public string breed { get; set; }public string size { get; set; }public CoatType coatType { get; set; }private List dogs; }public enum CoatType { Long, Short, Curly };My repository looks like this:public class AnimalRepository {private const string CacheKey = “AnimalStore”;public AnimalRepository(){var context = HttpContext.Current; if (context != null){if (context.Cache[CacheKey] == null){var contacts = new Dog[]{new Dog { name = “Lassie”, breed = “Collie”, size = “Medium”, coatType = CoatType.Long },new Dog { name = “Fido”, breed = “Labrador”, size = “Large” , coatType = CoatType.Short},};context.Cache[CacheKey] = contacts;}}}public Dog[] GetAllAnimals(){var context = HttpContext.Current;if (context != null){return (Dog[])context.Cache[CacheKey];}return new Dog[]{new Dog{name = “”,breed = “Placeholder”,size = “Placeholder”,coatType = CoatType.Curly}};}public bool SaveAnimal(Dog animal){var context = HttpContext.Current;if (context != null){try{var currentData = ((Dog[])context.Cache[CacheKey]).ToList();bool

  • Adrian Hope-Bailie
    c# arrays list ienumerable
    I am trying to accomplish something in C# that I do easily in Java. But having some trouble. I have an undefined number of arrays of objects of type T. A implements an interface I. I need an array of I at the end that is the sum of all values from all the

  • Eric Javier Hernandez Saura
    c# .net collections ienumerable
    I know that in .net collection types (or at least some collection types) do not allow modify the collection when you are iterating on it. For example in the List class exist a code like this:if (this.version != this.list._version)Thr

  • SWeko
    c# .net ienumerable
    I have this simple class with those 2 enum fields, I’m trying to find one item of this object in a collection (List) but the Contains methods doesn’t works correctlypublic class Calculator : IEqualityComparer {public DashboardsComputationMode ComputationMode { get; set; }public Modes Mode { get; set; }public Calculator(DashboardsComputationMode dashboardsComputationMode

  • Matthew
    c# linq performance ienumerable
    These two questions give similar algorthims for shuffling an IEnumerable:C#: Is using Random and OrderBy a good shuffle algorithm? Can you enumerate a collection in C# out of order?Here are the two methods side-by-side:public static IEnumerable Shuffle1

  • Max Ehrlich
    c# c#-4.0 generics ienumerable implicit-conversion
    I have a class that is used to hold values loaded from a configuration file. To make this class easier to use, I have set up many implicit conversions to some basic types. One of the types I would like to convert to is IEnumerable(T). For exa

  • Steve Fenton
    c# javascript ienumerable typescript
    I’m trying to implement the C# keyword yield with in JavaScript/TypeScript (doesn’t matter which): For example, I would like to implement the code://using System.Collections; //using System.Diagnostics; public static void Process() {// Display powers of 2 up to the exponent of 8: foreach (int number in Power(

Originally posted 2013-11-09 18:41:08.