Split List Into Sets Using Linq

Feb 7, 2011

There are plenty of seemingly related Linq questions, however a quick browse through the content doesn't seem to answer my question specifically enough for my limited intelligence to grasp.

We have a table named PropertyInteractions in which is stored threaded messages via a thread id, the thread identifier is the Id of the initial interaction record. Given the following Linq query (which retrieves all interactions concerning a user), how might I split interactions into lists of PropertyInteractions grouped by Id?

[Code]...

View 2 Replies


ADVERTISEMENT

C# - Split String To Hash Table Using LINQ

Jan 23, 2012

I have:
string s = "A=1,B=2,C=3";
I need the output in hashtable using LINQ. Hashtable should be filled as
["A"] | 1
["B"] | 2
["C"] | 3

View 2 Replies

Convert A List Linq Expression To Defined List Class?

May 26, 2012

y have this class

Private Class MyClass
Public Property propertyOne() as String
Public Property propertyTwo() as String

[code].....

View 2 Replies

.net - Create New Distinct List(of T) From Existing List(of T) Using LINQ?

Jun 1, 2011

How can I get a new distinct list from an existing list using LINQ? This is what I have so far and it is not distinct but does give me a new list.

Dim tmpQryColumn = (From a In _allAudits
Select New CheckBoxListItem
With {.Id = a.AuditColumn, .Name = a.AuditColumn}
).Distinct()
_columnList = New List(Of CheckBoxListItem)(tmpQryColumn)

View 2 Replies

.net - Searching A List Of Objects In An Object List Using Linq?

Dec 22, 2010

I have 2 classes

Public Class Shipper
Public Property ShipperID As Long
Public Property CreateDate As DateTime

[Code].....

View 1 Replies

Create New Distinct List(of T) From Existing List(of T) Using LINQ?

Mar 12, 2010

How can I get a new distinct list from an existing list using LINQ? This is what I have so far and it is not distinct but does give me a new list.

Dim tmpQryColumn = (From a In _allAudits
Select New CheckBoxListItem
With {.Id = a.AuditColumn, .Name = a.AuditColumn}

[code]......

View 2 Replies

Finding Items In One List That Aren't In A Second List Using Linq

Jan 25, 2011

I have two generic lists, named ListA and ListB. Both ListA and ListB could potentially have duplicate items. What I would like to do is use LINQ to grab the items in ListB that are not in ListA, but I'm unsure how to do so.

View 8 Replies

Linq - Create A List Of Integers From A List Of Objects?

Nov 23, 2011

I'm trying to create a list of days(integer) from a list of dates(date).

I tryed to do this....

[Code]...

View 4 Replies

Loop Against A List And Fill Another List From Its Data Using Linq

Jul 29, 2010

This is what I want to do as seen in C#(loop against a list and fill another list from its data using Linq)

[Code]...

View 1 Replies

Split A Selected Item In A List Box?

Nov 23, 2010

I'm having a problem with a program I am re-making. I used to be quite good at this stuff but I stopped and now I've pretty much forgotten everything. In hopes of gaining my knowledge back, I wanted to remake a program I made years ago but I'm having a problem.

I'm trying to split a selected item in a list box. This is what the item looks like:

|DATA|DATA|DATA|DATA/ELSE|

I can split it fine using this code:

Private Sub ListBox1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.Click
Dim LineofText As String

[Code].....

View 8 Replies

Getting List Of Items Not In Parent List Using LINQ

Mar 28, 2011

I am writing app in vb.net

I have two variables one with list of RoomRate and other with list of RoomTypes.

We have RoomRates and RoomTypes linked with RoomTypeInfo variable insite the RoomRate.

So how do i find the RoomTypes which donot have the RoomRates Defined.

My Sample Code:

class RoomType
property UIN as integer
property Title as string
end class

[Code]......

View 2 Replies

XML To LINQ - Get List Of All Products From XML Doc And Put Them Into A Generics List

Jun 30, 2009

I'm basically brand new to LINQ. I've seen some examples that allow me to strong type objects using LINQ but I don't really understand them because they're in C#, which I guess lets you do different things with LINQ(I think?). [Code] I just want to get a list of all the products from the XML doc and put them into a Generics list.

View 3 Replies

VS 2008 Split String - List Of Files

May 15, 2010

I have a range of strings (Basically filenames) and I want to strip them down. Basically I load a list of files (path/clubs/) and it lists them into a list box as club1.adf club2.adf etc. I then select club1.adf for example from the list box, and hit a button. The button then loads path/club1 into my application. So basically I want to split the .adf from the club1. Something like the following, I imagine?

[Code]...

View 5 Replies

VS 2008 - How To Split RichTextBox Text Into Array List

Aug 6, 2010

I have seen and used Text.split with a single delimiter such as " ",-","-".". However I cannot find a method which allows multiple delimiters. I need to be able to split a richTextBox's text into an array list.

View 14 Replies

C# - With LINQ, How To Transfer A List<List<string>> To List<string>

Dec 15, 2010

I got an object of List<List<string>>I need to bring this into a ist<string>I have no idea how to do this with LINQ.

View 1 Replies

Using Linq With A List(of T)

May 11, 2011

I am trying to use linq to query a List(of T) object, but when i type in my linq statement it comes back with the following error: Error57Expression of type 'System.Collections.Generic.List(Of BreakoutData)' is not queryable. Make sure you are not missing an assembly reference and/or namespace import for the LINQ provider.D:\Code\OLGA35\BreakoutByBusinessUnit.aspx17025D:\Code\OLGA35\

I have looked at my web.config and I have the imports:

<assemblies>
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral,

[CODE]...

I have put in several imports at the top of my page, but that hasn't helped

<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" %>

<%@ Import Namespace="System.Collections.Generic" %>
<%@ Import Namespace="System.Core" %>

[CODE]...

I'm not sure what to do at this point.

Here is the code that is relevant:

Dim ListCollection As List(Of List(Of BreakoutData))
Dim GroupList As List(Of String)
Dim DataList As List(Of BreakoutData)

[CODE]...

Everything i've found on google just says to add in the System.Core, System.Data.Linq references, but as far as I can tell it all is setup correctly

View 1 Replies

Using Linq With A List(of T)?

May 25, 2009

I am trying to use linq to query a List(of T) object, but when i type in my linq statement it comes back with the following error:

Error57Expression of type 'System.Collections.Generic.List(Of BreakoutData)' is not queryable. Make sure you are not missing an assembly reference and/or namespace import for the LINQ provider.D:\Code\OLGA35\BreakoutByBusinessUnit.aspx17025D:\Code\OLGA35\

[code].....

View 6 Replies

.net - Linq : Get Words From List?

Jun 8, 2011

I'm using a program see here: Visual Basic Regular Expression Question. I enter letters and the program returns all possible combinations from list. I want change this line of code...

Dim result = fruits.Where(Function(fruit) Not fruit.Except(letters).Any())

If I have this list:

Dim fruit as List(Of string) from {"apple","orange","pear","banana"}

And I input "p a p l e r" then it would return "apple" and "pear", but if I enter "a p l e r" then it would return just "pear". The idea is to return all words, which can be made of entered letters without duplicating any single letter. How to optimize this Linq code?

View 1 Replies

.net - Linq Query To List?

Sep 2, 2011

Dim query = From o In myContainer.MyObjects Select o.MyStringProperty Distinct
Dim myProperties As List(Of String) = query.ToList????? 'no way!!!'
"query" type is IEnumerable(Of String)

I tried to use the query directly as a DataSource of a (infragistic) combobox, but it throws me NullReferenceException, so I decided to convert it to a listof strings, to be a more "classical" datasource.

Dim values As List(Of String) = query.AsQueryable().ToList()
does not work either: Value of type 'System.Collections.Generic.List(Of System.Linq.IQueryable(Of String))' cannot be converted to 'System.Collections.Generic.List(Of String)'.

View 3 Replies

.net - Linq, Map List To CheckboxList

Dec 17, 2009

If I have a List(Of Guid) can I map those Guid's with a single Linq expression to a CheckboxList of values?

View 1 Replies

.net - Simple Linq To List(of T)

Jun 6, 2012

I trying to do what seems to be a simple thing but I'm having problems. The answers I find aren't working. I'm still getting casting exceptions:

Dim query = (From l In dePhl.cv_phil Where l.batch = strMmddyyyy
Select l.zipfile.Distinct)
Dim objFileList As List(Of String) = query.ToList() 'Error

[Code]....

View 1 Replies

.nPopulating A List In Linq?

Aug 21, 2010

Assume I have the following XML file:

<Movies>
<Movie ownerName="Ryan">
<Title>The Lord of the Rings Trilogy</Title>

[code].....

View 2 Replies

Filter A List With Linq?

May 3, 2011

Public Sub adjectAllNormals()

Dim qry As LinkedList(Of CElement) = From elm In Elements
From id In SelectIDs()
Where elm.ID = id
Console.WriteLine(qry.Count)
End Sub

View 1 Replies

Linq With Sorted List?

May 30, 2009

I have recently started using vs2008 for the linq feature but am having problems using it with a sorted list.my sorted list has a key of timestamp.I want to retrieve the first item from the sorted list having (key) timestamp <= myTimestamp.

View 8 Replies

Update List With Linq Instead Of For Each?

Mar 9, 2012

I am a bit new to linq, I am only using linq for filtering the data. [code]...

Con.Numbers is a dictionary, but now I converted it into a list, hence the above code wont work with list[code]....

View 2 Replies

Regex - Split String On Several Words, And Track Which Word Split?

Dec 15, 2010

I am trying to split a long string based on an array of words. For Example:Words: trying, long, array Sentence: "I am trying to split a long string based on an array of words."Resulting string array:Multiple instances of the same word is likely, so having two instances of trying cause a split, or of array, will probably happen.

View 5 Replies

Asp.net - Linq To Sql Convert To Generic List In .NET?

Jul 2, 2009

I am trying to learn some VB.NET for my coo-op that starts next week, and for that reason i took my portfolio web site that is on C# and just started to converting it to VB.NET to get familiar with the syntax.

I am sure my problem is simple however i have a hard time solving it. I am trying to grab data with the linq query and then return it as list to bind to the Repeater.I have the following function:

[Code]...

And it would work fine. However if I try to use ToList() in VB.NET i am getting error that it cannot convert it from ling to sql List to the generic list. How do i do this convertion in VB.NET ? or maybe there is another way ?

I am decent when it comes to C# however somewhat lost with the VB.NET syntax.

View 1 Replies

Copy Linq Query To List?

Sep 12, 2011

'Read RESX file and returns a List(Of ResXDataNode)[code]...

Provide two separate copies of the node? Or will the List and Linq query still be referencing the same data?

View 2 Replies

Get Distinct Values From List(Of T) Using Linq?

Mar 10, 2012

I have a List(Of Hardware) - the List is called HWModels

Class Hardware has the following Properties:

ModelName
Status
CPUStatus
MemoryStatus
DiskStatus

The List is populated by reading a CSV file, once it's populated, I want to return the distinct records based on the ModelName

I've attempted by doing it as follows:

(From a In HWModels Select a.ModelName).Distinct

But this isn't right because I end up with a list of only the ModelName's and nothing else.

How do I get the Distinct function to return all of the other class members within the list?

View 1 Replies

Grouping A Generic List Via LINQ?

Jun 26, 2011

I need to take a collection and group it via Linq but all the examples I've seen fail in some manner or other with some syntax difference that I can't quite lick.

My collection:

Dim a As New List(Of ProcessAlert)
a.Add(New ProcessAlert("0000112367", "5551110000@txt.att.net", "Alert", 2))
a.Add(New ProcessAlert("0000112367", "5551110000@txt.att.net", "Document", 2))

[Code].....

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved