I am implementing a class that basicaly wraps an array:
public abstract class IndividualBase : IEnumerable<Gene>
{
private readonly Gene[] genoma;
...
public IEnumerator<Gene> GetEnumerator()
{
return genoma.GetEnumerator();
}
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator(...
Assuming the class
public class Foo
{
public List<Bar> Bar = new List<Bar>();
public string Something;
public TStatus Status;
}
Bar is a class defined as
public class Bar
{
public string Code;
public string Message;
public TStatus Status;
}
I need to iterate the list Bar but I cant use a foreach because I ...
I have this class declaration:
Public Class clsColection(Of T)
Inherits System.Collections.ObjectModel.KeyedCollection(Of String, T)
Implements System.Collections.IEnumerable
Implements System.Collections.Generic.IEnumerable(Of T)
...
Public Shadows Function GetEnumerator() As System.Collections.Generic.IEnumerator(Of T...
If I have an object that among other things is an IEnumerable and I dump this object I get the enumerated values.
Is there a way to get Linqpad to list the other properties:
Se example below:
Can I get Dump to include Hello and digits properties?
void Main()
{
var t = new test();
var d = new Dictionary<string,string> {{"Hello"...
I have 2 IEnumerable of Type1 and Type2, ie. IEnumerable<Type1> & IEnumerable<Type2>. Type1 and Type2 have 1 common field, called TypeID. Multiple of same TypeID may exists in IEnumerable<Type2>, I would like to check against the 2 IEnumerables and if TypeID inside Type2 equals to TypeID inside Type1, I would combine the 2 into a new obj...
I have a variable IEnumerable<IEnumerable<int>>. I'm trying to somehow aggregate it into an IEnumerable<int> which enumerates over all the integers in order. (All the integers from the first set, then all the integers from the second, etc.) I looked into LINQ's aggregate method, but the only examples I found was string concatenation, and...
How can I check if the return type of a function is IEnumerable<T>? In other words, I don't want to match List<T>, even though it implements IEnumerable<T>. Or put even another way, how can I detect if a function has deferred execution?
...
Hi,
My question is about enumerating Dictionary elements
// Dictionary definition
private Dictionary<string, string> _Dictionary = new Dictionary<string, string>();
// add values using add
_Dictionary.Add("orange", "1");
_Dictionary.Add("apple", "4");
_Dictionary.Add("cucumber", "6");
// add values using []
_Dictionary["banana"] = ...
Please i need help:
i have a listbox binded to IEnumerable source
Person is a class that contains the following properties: Name (string), isChecked(bool)
i need to change the property "isChecked" for a specific person with the name "Bob"
i'm not able to change the value of the property!
please help
...
Given two IEnumerables of the same size, how can I convert it to a Dictionary using Linq?
IEnumerable<string> keys = new List<string>() { "A", "B", "C" };
IEnumerable<string> values = new List<string>() { "Val A", "Val B", "Val C" };
var dictionary = /* Linq ? */;
And the expected output is:
A: Val A
B: Val B
C: Val C
I wonder if ...
Hi,
In .NET Framework, there are some classes which use SomethingCollection syntax.
For example, when dealing with SqlCommand, it has a parameter Parameters of type SqlParameterCollection. Since it does not have a form of IEnumerable<SqlParameter> (or IList<SqlParameter> or something similar), it is impossible to write:
foreach (var c...
Hi guys,
I'm following the sportsStore tutorial from the Apress Pro Mvc 2 Framework book.
It's been a while since I touched .net, and I'm completely new to Mvc and I've fallen at the first stumbling block!
I have the following error:
foreach statement cannot operate on
variables of type
'IENumerable'
because
'IENumerable...