linq

wpf overriding getHashCode and Eqaul in ContentControl

Hi I have a class which derives from ContentControl and I'm not able to override GetHashCode and Equal method. I get an error Error 5 cannot override inherited member 'System.Windows.DependencyObject.GetHashCode()' because it is sealed Is there any way to override this method ? I need to use Union method from LINQ however I need to c...

Linq join on parameterized distinct key CASE INSENSITIVE

To revisit a previous question with a further stipulation... Anyone know how to do the following, IGNORING CASE? Dim Matches = From mRows In LinqMasterTable Join sRows In LinqSecondTable _ On mRows(ThePrimaryKey) Equals sRows(TheForignKey) _ Order By mRows(ThePrimaryKey) _ Select mRows, sRows For details ab...

LINQ to SQL use of => operand on String not allowed

Possible Duplicate: string1 >= string2 not implemented in Linq to SQL, any workarround? To give a brief summary of what I want to achieve we have a table called Application and it stores application version numbers. The contents of that Table for example is ApplicationID VersionID 1 R1.01.01.01 ...

Dynamically Adding a GroupBy to a Lamba Expression

Hi guys, Ok, I'll admit that I don't entirely "get" lamda expressions and LINQ expression trees yet; a lot of what I'm doing is cutting and pasting and seeing what works. I've looked over lots of documentation, but I still haven't found the my "aha" moment yet. With that being said... I'm attempting to dynamically add a GroupBy express...

C# Appending Linq Queries of Same Type

I have two linq queries that I run on two different tables, Car and Truck. From these queries I select the ID, Name, and Company. var car = from c in db.Cars select new {ID = c.ID, Name = c.Name, Company = c.Company}; var truck = from t in db.Trucks select new {ID = t.ID, Name = t.Name, Company = t.Company}; How ...

How do i convert from one collection to another

i have: IEnumerable<Foo> foolist and i want to convert this to: IEnumerable<Bar> barlist is there a linq / lambda solution to move from one to the other both objects (foo and bar) have simple properties that i am going to convert. for example: bar.MyYear = foo.Year they each have about 6 properties ...

how to use parameter in linq to select different columns

i want to use linq to select certain columns to populate each combobox. right i have individual linq query to do the job. i wish to write a method to do that. var getUserName = Entity.Select(a=>a.Username); var getType = Entity.Select(a=>a.Type); var getAddress = Entity.Select(a=>a.Address); can i do something like that: Public...

All built-in .Net attributes

I have used AppDomain.CurrentDomain.GetAssemblies() to list all assemblies, but how do I list all built-in attributes in .NET 2.0 using C#? ...

linq to xml navigate through xml c#

I have some XML and need to be able to read the data within. A sample of the XML is <?xml version="1.0" ?> <ConsumeLeadRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt; <LeadType>Mortgage</LeadType> <LeadXml> <ns1:LeadAssigned xmlns:ns1="http://YaddaYadda" xmlns:ns0...

How do I just LINQ Join() to link two IQueryables?

I have two IQueryables: Ingredient: IngId Description AvailableIngredient: IngId I already have an IQueryable for Ingredient: var ingQuery = from i in context.Ingredients select i; How can I add a join to his so it filters by AvailableIngredient (i.e. an Inner Join)? I know how to do it if I had to join all the t...

how retrive the values from list using indexes by linq query

I have int list contains 5,6,7,8,5,4,3 i like retrieve the value from list using there index, for example i give start index as 1 and end index 4 i will get 6,7,8,5 in new list,how can i do this in linq ...

exposing sql server data from an asp.net webapp to silverlight and win forms via linq

hi, I have an asp.net web app which holds its data in an sql server 08 r2 db. I have a silverlight admin interface on the same web app, and I will have a win forms app which will need to add/retrieve data from the sql db. Is there a way I can use linq in both clients? I mean something like linq2twitter, where in the silverlight or in ...

Chaining MapHierarchy() to add more Cases in EF code first

I'm hoping there will be a crazy linq answer to this, it feels like there should be Current code: MapHierarchy().Case<Folder>(f => new { FolderId = f.Id, f.Name, Type = 1 }) .Case<RootFolder>(f => new { f.RootName, ...

Linq to SQL Performance

Succinct How do I performance tune my Linq To SQL DAL methods? Specifically the amount of data being transferred. Verbose I have a Winform app that uses Linq To Sql to access it's data. We have 5 branches, 1 physically at the same location as the SQL server and the other 4 at various distances and bandwidths. My app is your typical...

Linq orderby two-column sort with custom comparer

List<MyObject> objects = (from a in alist join b in blist on a.ID equals b.ID where a.Number != 4 orderby b.Rank, a.CustomField select a).ToList(); This is my query and I want to use a custom Comparer for the CustomField property. Is there a way to do that in a two-field orderby? I am able to do this: List<MyObject> o...

Like SQL Query in LINQ

Hi, My problem is the following: I'm looking for a solution in LINQ which translates a LINQ expression to SQL LIKE query. (I know in LINQ I can use Contains, StarsWidth, EndWidth instead of 'LIKE' but in my case is not a good solution, and if you check the generated sql script you will see it is not use LIKE) I found a lot of article...

Why is this defaultIfEmpty choosing ienumerable<char> instead of string?

from a in mainDoc.XPathSelectElements("//AssembliesMetrics/Assembly/@Assembly") let aVal=a.Value where aVal.IsNullOrEmpty( )==false&&aVal.Contains(" ") select aVal.Substring(0, aVal.IndexOf(' ')) into aName ...

Linq to SQL Contains Method Throwing Unsupported Overload Exception

I have a List and each Filter object has a property called "Id". I want to fetch all the records from my database using Linq to SQL that contains those ids. The List is not part of the database it is just an independent list. ...

VB.Net I'm trying to write an extension for a generic linq search, however I'm not sure how to return more than one result 0.o

I'm a bit new to vb.net and used to working in perl, this is what I'd like to do. I wanted something similar to DBIX::Class::Resultset's search (from cpan) in my vb.net project, so that I can give my function a hash containing keys and values to search on a table. Currently it returns a single matching result of type T where I want it ...

C# coercion operator?

I got this test: [Fact] public void EverythingIsMappedJustFine(){ new AutoMapperTask().Execute(); Mapper.AssertConfigurationIsValid(); } It throws a bit strange exception: Test 'Unit.Web.Bootstrap.AutoMapperFacts.EverythingIsMappedJustFine' failed: System.InvalidOperationException : No coercion operator is defined betwee...