I am messing around with LINQ and I am curious to see what I can do with it. I would like to know if it is possible to have a LINQ query that imposes a condition over the resultant set. For example, let's say I have a List of several words, and I wish to find sets of words that form a chain (i.e. last letter of a word = first letter of n...
Hi All,
how can I split a sequence of numbers into subgroups of numbers and get the local minimum and maximum of the subgroups with linq?
If I have a sequence of, lets say 11 items { 3, 2, 5, 9, 9, 6, 7, 2, 5, 11, 2 }
I want to split this into subgroups with 3 or less items.
So I get the following 4 subgroups: { 3, 2, 5 } , { 9, 9, ...
I've just written a couple of pagination extension methods and I was curious to know if there was any improvements I could make.
I'm pretty happy with the base pagination method, where you supply both the page size and page number (as seen below)
public static IEnumerable<T> Paginate<T>(this IEnumerable<T> source, int pageSize, int...
List<PersonsInChargeEntity> picList = new List<PersonsInChargeEntity>();
List<ClientEntity> clientList = new List<ClientEntity>();
var returnList = (from PersonsInChargeEntity pic in picList
join ClientEntity client in clientList
on pic.ClientNumber equals client.ClientNumber
...
I'm currently building a .net web application that uses WCF web services to allow a Flex front end to access the database.
I'm in the process of setting up some unit/integration style testing on the web services and am trying to work out the best way to allow the tests to access and modify data in a separate test database.
Currently, t...
For anyone interested in learning LINQ To SQL, could you suggest:
good book titles
web articles/tutorials
videos
UPDATE: After googling i found most usefull the following
LinqPad (I already bought a licence!)
Linq in Action by Manning and
Linq videos from the VB Team
Please be my guest and complete the list!
...
I'm using Lookup class in C# as my prime data container for the user to select values from two Checked List boxes.
The Lookup class is far easier to use than using the class Dictionary>, however I cannot find methods for removing and adding values to a lookup class.
I thought about using the where and the union, but i cant seem to get...
I have class Zones with properties and i want add data which i read with linq to this properties.
example
List<Zones> z = new List<Zones>
z.add(new Zones(...));
var allZones = from s in db.Zones select s;
How can i add allZones to z generic List?
...
I've looked all over and haven't been able to find a clear answer to a seemingly common question: How can I do two-way databinding over a many-to-many relationship in ASP.net?
I have the following database structure:
I am currently writing a page for editing or adding a User record. Databinding things such as name and password is simp...
Hi,
I have a list of items I am retrieving which i wish to be grouped into divs
depending on the common name that a set of the list items may have
say for instance a list of firstnames I have.
i would like to be able to create a div dynamically based on the items common attibutes.
id 23
fistname darren
id 37
fistname darren
id 67 ...
I am working on a projection utility and have one last (more?) hurdle to clear...
Here is the scenario:
public class Person
{
public string FirstName { get; set; }
public string LastName { get; set; }
public int? AddressID { get; set; }
public Address Address { get; set; }
public string Otherproperty1 { get; set; }
...
I have an enum called OrderStatus, and it contains various statuses that an Order can be in:
Created
Pending
Waiting
Valid
Active
Processed
Completed
What I want to do is create a LINQ statement that will tell me if the OrderStaus is Valid, Active, Processed or Completed.
Right now I have something like:
var status in Order.Status...
What articles/tutorials can you recommend for LINQ Expression Trees?
...
Hello,
I have a datasource with columns id,myname,eventime,ceasetime.
I need to find out duplicate date ranges for a given Key. I tried to use -
(from data1 in myDatasource
from data2 in myDatasource
where data1.SeqId != data2.SeqId
&& data1.myname ==data2.myname
where data1.Event_Time <=data2.Cease_...
I need to calculate how many times each keyword is reoccurring in a string, with sorting by highest number.
What's the fastest algorithm available in .NET code for this purpose?
...
I have a request for a feature to be able to save a user's search for later.
Right now I'm building LINQ statements on the fly based on what the user has specified.
So I started wondering, is there an easy way for me to simply take the query that the user built, and persist it somewhere, preferably my database, so that I can retrieve i...
In LINQ, you can write a manual SQL query, take the results from it and have LINQ "map" those into the appropriate properties of your Model classes (or at least, I'm pretty sure I read you can do that).
Is it possible to do something like that in Entity Framework?
I have an web app that's using EF, and it's CPU usage is ridiculously hi...
Within my application i have a PUBLIC customer class...
Public Class Customer
Public Name As String
Public Surname As String
End Class
Then i decided to use LINQ to SQL within my application.
After adding the MyDatabase.dbml class, errors showed up since LINQ creates public properties too
<Column(Storage:="_Name", DbType:="NV...
I am creating an xml file with LINQ as follows...
Public Sub CreateXml()
Dim db As New MDataContext
Dim Customers = <gallery columns="3" rows="3">
<%= From customer In db.Customers _
Select <customer>
<name><%= custo...
Followup on answer to an earlier question.
Is there a way to further reduce this, avoiding the external String.Split call? The goal is an associative container of {token, count}.
string src = "for each character in the string, take the rest of the " +
"string starting from that character " +
"as a substring; count it if it s...