Questions for linq


Using LINQ find nearby places from database

We want to receive list of nearby places from database using LINQ in ASP.NET 2012 and would like some feedback on our strategy.

MvcMusicStore No elements in sequence

I am working through the Mvc Music Store tutorial and am stuck on this LINQ query as it keeps telling me that the sequence has no elements. My model matches the model in the tutorial and I have ins...

Filtering Windows logs using lambda expressions on non-IEnumerable types

I'm trying to get and filter Windows logs based on some criteria, one of which is filter by Message. The Message property is in EventLog.GetEventLogs().Entries.Message. The problem is Entries is an

LINQ to SQL: Multiple / Single .dbml per project?

I've read Rick Strahl's article on Linq to SQL DataContext Lifetime Management hoping to find some answers on how I would manage my .dbml files since they are so closely related to DataContext.

Read CSV data in batches and Process it

I have a csv file that looks like this

Easiest way to convert IGrouping to IHierarchicalDataSource

I have a list of business objects that I want to display in a menu. I can quickly use LINQ to created nested groups to match the desired structure but have to manually iterate through each to

Linq to SQL: How do I stop the auto generated object name from being renamed?

In visual studio 2008, when I drag a database table into my dbml screen, any tables that end with the letter s automatcially get the s removed from the dbml object. Is there any way to disable thi...

more than 1 sequence of random numbers c#, linq

i was using this code to generate a random sequence of numbers:

DataGridView not sortable when AutoGenerateColumns = true + Anonymous Types?

Can DataGridView be sortable when is bound to an anonymous type? If yes, how?

Add to generic List property and save in viewstate

I'm using a generic List to store a set of data in the viewstate. If I try sorting the list using linq in the get accessor then when I try to add a new item to the list if doesn't work. No error, i...

Receiving Object reference not set to an instance of an object. on simple datetime retrieval from Raven

Not sure why its complaining about this error, but when comparing time stamps to I get a object reference error. Here is the simple code.

Filter XDocument more efficiently

I would like to filter with high performance XML elements from an XML document.

Making Linq operations to a database in Data Connections

I am using Visual Studo 2012 and SQLExpress.

Convert Linq ObjectQuery IQueryable to IEnumerable

Totally confused about the data types required here.

Write and stream a templated Xml as efficiently as possible

I am trying to find the best solution to prevent us to allocate too much memory when building an Xml document. I have to construct a fairly large Xml with the less resource possible (the web servic...

Ignoring accents in SQL Server using LINQ to SQL

How can I ignore accents (like ´, `, ~) in queries made to a SQL Server database using LINQ to SQL?

.NET MVC4, Entity, Search

I have an MVC4 project using EF. I have set up my schema so that all searchable items have have a Table that relates them to a "Tags" table. I am wondering what is the most efficient way to do a full

Getting from dynamic Request to a List

My code is working nicelly but I would like to know if you can suggest something more performatic to get the values frm my dynamic controls.

How do I apply OrderBy on an IQueryable using a string column name within a generic extension method?

public static IQueryable<TResult> ApplySortFilter<T, TResult>(this IQueryable<T> query, string columnName)

How to merge a collection of collections in Linq

I would like to be able to fusion an IEnumerable<IEnumerable<T>> into IEnumerable<T> (i.e. merge all individual collections into one). The Union operators only applies to two

Linq SelectMany query

I have the following query:

C# Linq data structure, for eventual data binding. Best way to do?

I have a set of "parts". Each part has a name and set of attributes. An attribute is a set of string keys and values. For example:

Using SequenceEqual and then returning which elements don't match

I have two List<string> and I am using the SequenceEqual method to determine if they match.

Linq to FileHelpers Class

I am trying to get the results of a linq query int a file. I created and array of the same type as the FileHelpers class I created, then queried the data and assigned the values to the array I just

Order by on String's substring in Linq

I have a date field for which I convert the value of the database from datetime to string format("dd-MMM-yyyy"), I need to perform sorting this string date field, but seems like when I have been do...

find LINQ queries in C# files

I need to find out LINQ queries while parsing C# files (with Irony Codeparser), because the parser does not support LINQ - therefore I have to exclude or modify such files, where LINQ occurs.

Compiler error when replacing Lambda expression with method group

I love the Linq syntax and its power, but sometimes I just can't understand why things work as they work.

Can some one help me solve this logic using C#

Below is the logic for what I am trying to do .Can some one help me solve this using C#.

Add folder files to listbox by LINQ

I use the below code to get files with different extensions in the folder by LINQ, but no file is found.

Is it possible to Serialize a LINQ object?

I'd like to serialize some LINQ generated objects and store them in a table as a binary field (Never you mind why). I'd like to be able to write some code that looks something like this:

Trouble writing predicates to search a repository with Entity Framework (equivalent to using a Join in SQL)

We are using code first Entity Framework 4.1 to persist data. Some of our entities have a relationship like this:

Handling very large strings between SQL Server and .NET code +LINQ

I have an app that needs to handle very large strings between a SQL Server database and .NET code. I have a LINQ query that generates the strings when saving them to the database, but when trying to

Linq. Select from multiple tables

In project I have this tables:

LINQ with FoxPro?

Is there a reasonable way to access FoxPro databases using LINQ?

Determine 2 diagrams relative position using LINQ

I have two arrays of points: double[] minus and double[] plus, e.g.:

The concise way to initialize an array of reference type object

I wonder if there is better way to initialize an array of reference type object, like this.

linq, mvc and partial class

I have dbml with single table users

Which method performs better: .Any() vs .Count() > 0?

in the System.Linq namespace, we can now extend our IEnumerable's to have theAny() and Count() extension methods.

entity framework grouping by datetime

Every 5 minutes a row in a sql server table is added. The fields are:

MVC LINQ dynamic orderBy getting column type

I am trying to dynamically order a list of products.

Is there a C# unit test framework that supports arbitrary expressions rather than a limited set of adhoc methods?

Basically NUnit, xUnit, MbUnit, MsTest and the like have methods similar to the following:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.