Scenario
Having already read a post on this on the same site, which didn't work, I'm feeling a bit stumped but I'm sure I've done this before.
I have a Dictionary.
I want to take the first 200 values from the Dictionary.
CODE
Dictionary<int,SomeObject> oldDict = new Dictionary<int,SomeObject>();
//oldDict gets populated somewhere...
Hello,
I'm fighting from some time with taking a screenshot of Android OpenGL.
The code I found is as follows:
nt size = width * height;
ByteBuffer buf = ByteBuffer.allocateDirect(size * 4);
buf.order(ByteOrder.nativeOrder());
glContext.glReadPixels(0, 0, width, height, GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE, buf);
int da...
i have the following code using Nhibernate.Linq
var apps = Session.Linq<History>().OrderByDescending(r => r.LastUpdated).Take(50);
Console.Write(apps.Count());
the count returns 1000 (NOT 50 which is what i would have expected)
any ideas why the .Take() is not working?
...
I know in python you can do something like myList[1:20] but is there anything similar to C#?
Thanks!
...
I have a table that looks like this:
Id GroupId Value
and it has about 100 rows
How can I return the top 10 rows for value but with no duplicating GroupId?
...
How would one take a List (using LINQ) and break it into a List of Lists partitioning the original list on every 8th entry?
I imagine something like this would involve Skip and/or Take, but I'm still pretty new to LINQ.
Edit: Using C# / .Net 3.5
...
Suppose following codes:
IEnumerable<MyClass> MakeQuery()
{
var query = from m in session.Linq<MyClass>()
select m;
return query;
}
List<MyClass> m1()
{
return MakeQuery()
.Skip(10)
.Take(20)
.ToList<MyClass>();
}
List<MyClass> m2()
{
var query = from m in session.Linq<MyClass>()
select ...