I've got a MyGrid.Children UIElementCollection, I would like to find all the Rectangles in it that have there styles set to StyleA, and set them to StyleB.
I'd like to use LINQ if possible, so I can avoid a nasty nested loop.
Something like this pseudocode:
var Recs = from r in MyGrid.Children
where r.Style == Styl...
So, the following lambda expression is not returning any elements in the collection, even though while stepping through I was able to verify that 1 item matches the criteria. I've added a sample of the class with it's IEquatable implementation.
...within a method, foo is a method parameter
var singleFoo = _barCollection.SingleOrDefault(...
I have a LINQ question. Let's say I have a database with the following values:
===================
Date,product,orders
-------------------
1/2/2003,apple,3
1/2/2003,orange,5
1/3/2003,orange,6
1/4/2003,grape,2
===================
How can I use LINQ to get a result that groups the items by date and puts them into a variable that looks ...
I have a standard store schema with an InvoiceLine table that contains Products. I'd like to get a list of the top 5 products by sales as a List. What's the cleanest way to do that? This can't be the best way:
private List<Product> GetTopProducts(int count)
{
var topProducts = from invoiceLine in storeDB.InvoiceLines
...
Hi all. I have a Silverlight Business Application project set up, with these codes.
I have this domain class:
public class BaseDomain
{
public virtual Guid Id { get; set; }
public virtual DateTime CreatedOn { get; set; }
}
public class Sector : BaseDomain
{
public virtual string Code { get; set; }
public virtual string...
Consider this array
string[] presidents = {
"Adams", "Arthur", "Buchanan", "Bush", "Carter", "Cleveland",
"Clinton", "Coolidge", "Eisenhower", "Fillmore", "Ford", "Garfield",
"Grant", "Harding", "Harrison", "Hayes", "Hoover", "Jackson",
"Jefferson", "Johnson", "Kennedy", "Lincoln...
Hello
After searching online and going through past stackoverflow posts for a suitable implementation for dynamic ordering with linq, i came up with my own implementation that borrows a few things from other solutions i have previously seen.
What i need to know is if this implementation is threadsafe? I don't believe it is as i am pas...
Linq to SQL, in the dbml designer (or otherwise)
I have 3 tables:
Orders, Deliveries and EmailTemplates.
Orders have many Deliveries, and Orders and Deliveries have a status (int) field.
EmailTemplates have a status they apply to and a bool IsForDeliveries field.
I have Linq to sql associations for Order->EmailTemplate on order.st...
I have a XML source with nodes like this (Somewhat anonymized):
<XXX>
<Code A="oa ">01</Code>
<Name A="oa ">Card</Name>
<F1 A="oa ">x</F1>
<F2 A="oa ">y</F2>
<F3 A="oa ">z</F3>
</XXX>
I load the XML-document into a XElement and query it with linq
var query = from creditcard in xml.Descend...
Can anyone tell me why I do not get intellisense with this code:
var testDocuments = (from u in db.TestDocuments
orderby u.WhenCreated descending
select u).
but I do get intellisense with this code:
var testDocuments = (from u in db.TestDocuments
orderby u.WhenCreated des...
Since the automatic scaffolding of ASP.NET Dynamic Data Web Pages does most of the things I need to do for this project on its on, I'd like to use it as a basis.
Now, I like to add another link to the "Edit" "Delete" "Details" trio on my custom table view. I'd like it behave much like the "Delete" button, i.e. not call another page, but...
I am facing a problem while reading the excel and writing them to XML using LINQ to XML.
I am having a column name as PinCode which has values like
9999
12
"123"
"20"
"999"
3
While converting the excel to dataset I have the values 9999,12,3. I am not able to retrieve the values in string format.
I dont want to change the formats in ex...
Hi, i'm using the method elementat for get a specific element of a query's result.
var mds = db.TDP_MissioniDestinazioni.Where(p => p.MissioneID == missioneRow.MissioneID);
destinazioneRow = mds.ElementAt(i);
LINQ to Entities does not recognize the method 'TimeEntModel.TDP_MissioniDestinazioni ElementAt[TDP_MissioniDestinazioni](S...
Hello guys I have the following method:
var usuario;
usuario = UniapontaService.GetUsuarioUniapontaPlanejamentoEstrategico(x => x.IdUsuario == VWUsuarioUniaponta.IdUsuario &&
x.PlanejamentoEstrategico.IdPlanejamentoEstrategico == HorarioTrabalhoCorrente.PlanejamentoEstrategico.IdPlanejamentoEstrategico...
Hello,
I have a LINQ statement that returns an anonymous type. I need to get this type to be an ObservableCollection in my Silverlight application. However, the closest I can get it to a
List myObjects;
Can someone tell me how to do this?
ObservableCollection<MyTasks> visibleTasks = e.Result;
var filteredResults = from visibleTask i...
Here's the scenario:
Process 1 (P1) - reads in various flat files one consequence of which is deleting or adding photos URLs to a database table to indicate that these need to be downloaded
Process 2 (P2) - Looks up the photo URLs that need to be downloaded, actually performs the download, then marks the record as downloaded
P1 and P...
Hello,
Here is my scenario:
We have a legacy system that has about 100 views that all pull the same columns worth of data.
Now, in my DataContext I have all the views in the context and I have a seperate query from each one. Each query's results loads into a single List that gets returned to the application.
Is it possible to have a s...
I have a list of an object which need to be sorted depending on three different properties of the object.
Example
CLass Object1{ Property1 , Property2, Property3}
ListObj = IEnumerable<Object1>
Foreach ( item in ListObj){
if (item.Property1 == true)
item goes at top of list
if(item.Property2 == true)
item goes e...
i have function
public List<Menu> List(int? parentId)
{
return (from i in _dataContext.Menu where i.Menu2.Id == parentId select i).ToList();
}
if i pass in function parameter null (like List(null)) it search nothing, but if i put null in query like this
return (from i in _dataContext.Menu where ...
In such a query:
var q = from l in session.Linq<Letter>()
where
letterTypeSearch == null ? true :
(l.LetterType.ToString() == letterTypeSearch)
l.LetterType is an Enum.
UPDATE
It seems that's impossible to compare Enums in current linq-to-nhibernate. While letterTypeSearch is a string containing a LetterType instance...