I'm trying to get all the sublists that don't inherit from a specified class and also get the parent/root list type. I can't quite figure out the syntax. Here's an example of the sort of thing I'm looking for. Thanks for any help you can give!
public class Foo
{
public IList<Type> Bar { get; private set; }
}
List<Foo> test = new L...
This should be and easy one for the LINQ gurus out there.
I'm doing a complex Query using UNIONS and CONTAINSTABLE in my database to return ranked results to my application.
I'm getting duplicates in my returned data. This is expected. I'm using CONTAINSTABLE and CONTAINS to get all the results I need. CONTAINSTABLE is ranked by SQL a...
Im writing my own LINQ reference but Im getting troubles with some of the more complicated operators implementations.
There is a Join implementation that takes a IEqualityComparer Im getting just crazy.
Im trying to understand it first before I write (obviously)
Image this two lists:
List<string> initials = new List<string> {"A", "B"...
Given a simple parent/child class structure. I want to use linqkit to apply a child lambda expression on the parent. I also want the Lambda expression to be provided by a utility method.
public class Foo
{
public Bar Bar { get; set; }
}
public class Bar
{
public string Value { get; set; }
public static Expression<Func<Bar...
I have two enumerables with the exact same reference elements, and wondering why Equals wouldn't be true.
As a side question, the code below to compare each element works, but there must be a more elegant way
Cheers,
Berryl
var other = (ActivityService) obj;
if (!AllAccounts.Count().Equals(other.AllAccounts.Count())) return false;
for...
Hi guys,
I have the following schema.
What I'd like to do is to retrieve all customers (and children properties) from a selected StaffAssignment by StaffId.
So I've written the following query:
from c in ObjectContext.Customers.Include("Assignments.Activities")
from a in c.Assignments
from sa in a.Staff...
Hi,
I get the collection from webservice:
var allPlaceHolders =
from ph in new MyService().GetPlaceHolders()
select new { Code = ph.Code, Name = ph.Name, Related = false };
dgPlaceHoldersAdd.DataSource = allPlaceHolders.ToList();
Designer.cs:
this.dgPlaceHoldersAdd.ColumnHeadersHeightSizeMode =
System.Windows.Forms.Da...
I'm trying to do the following:
from c in db.GetAllContactsQuery()
select new
{
ID= c.ID,
LastName = c.LastName,
FirstName = c.FirstName,
Email = c.Email,
City =c.City+" "+c.State
}
The issue i'm running into is that if c.City or c.State are null, the City property returns null. How can I put a function right beside tha...
Hi,
I'm using LINQ to SQL to select some columns from one table. I want to get rid of the duplicate result also.
Dim customer = (From cus In db.Customers Select cus.CustomerId, cus.CustomerName).Distinct
Result:
1 David
2 James
1 David
3 Smith
2 James
5 Joe
Wanted result:
1 David
2 James
3 Smith
5 Joe
Can ...
Hi,
Say I have the following class:
class Foo
{
// ctor etc here
public string Bar
{
get;
}
}
Now, I have a LinkedList of Foos declared like so: LinkedList<Foo>
How would I write a basic Contains<>() for this?
I want to be able to do this:
Foo foo = new Foo(someString);
LinkedList<Foo> list = new LinkedLis...
I have the following SQL query:
select
p1.[id],
p1.[useraccountid],
p1.[subject],
p1.[message],
p1.[views],
p1.[parentid],
max(
case
when p2.[created] is null then p1.[created]
else p2.[created]
end
) as LastUpdate
from forumposts p1
left join
(
...
A good thing in LINQ to SQL was a fast and reliable way to map database tables and convert them into classes accessible from c# project. However it is no longer recommended to create projects using LINQ to SQL.
What is its substitute? What kind of tool should I use in VS 2010 today if I want to have the same functionality as I had with ...
Hi.
I want to develop a multiuser supporting accounting management application in C#.
I want to use Linq To SQL classes. LINQ to SQL only supports SQL Server/Compact. However is it possible the SQLite people have written their own LINQ provider given the name of the assembly.
I have to use DBMS that is FREE. Which DBMS do you suggest...
B"H
I have an application that has been working for months using Linq to SQL connecting to a SQLExpress.
I tried migrating it to SQL Azure. I copied the structure and data using the Sync Framework.
I viewed the data in SQL Azure using SSMS 2008 R2 and it seams to be exactly what I have in my Sql Server.
However when I try to use Linq t...
Hi, i've got a table like that :
Article Number Last Voucher Number Last Voucher Date
0557934 519048 04/02/2005
0557934 519067 04/02/2005
0557934 528630 09/29/2005
0557934 528631 09/29/2005
0557934 529374 10/13/2...
I've got an array var cells = new Cell[w, h], can I loop through all cells without a nested for-loop (I want to check if at least one is null)? Ideally I'd want to write something like Debug.Assert(!cells.Contains(null)).
...
Hi this is my code
var cityList = from country in doc.Element("result").Element("cities").Descendants("city")
select new
{
Name = country.Element("name").Value,
Code = country.Element("code").Value,
Co...
IQueryable items = from rr in _dt.AllItems
where rr.ID == ItemID
select new{rr.Item, rr.SecondItem};
SecondItem is returning false or true. Is it possible to replace with different string values (for example with On and Off) and add to the items (IQueryable)?
...
I have an xml file that contains its element like
<ab:test>Str</ab:test>
When i am trying to access it using the code
XElement tempElement = doc.Descendants(XName.Get("ab:test")).FirstOrDefault();
Its giving me error
System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Xml.XmlExc...
I am having trouble trying to convert the following query from SQL to Linq, in particular with the having count and group by parts of the query:
select ProjectID
from ProjectAssociation
where TeamID in ( select TeamID
from [User]
where UserID in (4))
group by ProjectID
having COUNT(TeamID) = (select...