I've a List of this type List> that contains this
List<int> A = new List<int> {1, 2, 3, 4, 5};
List<int> B = new List<int> {0, 1};
List<int> C = new List<int> {6};
List<int> X = new List<int> {....,....};
I want to have all combinations like this
1-0-6
1-1-6
2-0-6
2-1-6
3-0-6
and so on.
According to you is This possibile to resolv...
I recently came across this raytracer in LINQ. Just wondering if anyone can top that?
var pixelsQuery =
from y in Enumerable.Range(0, screenHeight)
let recenterY = -(y - (screenHeight / 2.0)) / (2.0 * screenHeight)
select from x in Enumerable.Range(0, screenWidth)
let recenterX = (x - (screenWidth / 2.0)) / (2.0 * screenWidth)
...
I've a problem!
I've a
List <List<Class>> L = new List<List<Class>>();
where Class contains
IDLinea
Posizione
And so on...
I want to have a Distinct List<List<Class>> Where there are no objects with same lines.
For example:
List <List<Class>> L = new List<List<Class>>();
var A = new List<Class>();
Class C = new Class();
C.ID...
I'm using the ADO.NET Entity Framework to manage a hierarchy of objects. Each has a single parent and zero or more children.
I present these in my WPF application with a TreeView control. New Things may be added as children to the selected Things with the click of a button...
Visual Basic...
Private Sub ButtonAddThing_Click(...) ...
hi
I am calling a stored procedure using Linq2Sql, and the sp returns a long xml string as the result, from a select statment.
I'm using IMultipleResults.GetResult<>() to retrieve the string. Everyting is fine except when the Xml string is too long, and the GetResult returns only a partial output.
Is there any constraint on IMultiple...
My table has a timestamp column named "RowVer" which LINQ maps to type System.Data.Linq.Binary. This data type seems useless to me because (unless I'm missing something) I can't do things like this:
// Select all records that changed since the last time we inserted/updated.
IEnumerable<UserSession> rows = db.UserSessions.Where
( usr => ...
I'm trying to find a good reference to help me convert this TSQL statement to Linq:
EXAMPLE:
SELECT * FROM Categories WHERE ProductID IN (SELECT ProductID FROM ProductCategories WHERE CatID = 23)
I can't find anywhere that references how to do the WHERE "IN" part.
...
hi there, i'm using sql server 2008, asp.net mvc and linq.
Should i use LINQ skip and take method for paging, or do my self paging sql query script
which way more efficient than
...
ok, this is kind of funny. I have an InsertAction() function to do some error checks before inserting into the database. The problem is that I'm using myContext.InserOnSubmit() from within this OnValidate function and that causes an infinite loop (the class keeps calling itself)
am i supposed to just set some property to True or somethi...
Data :
Empcode Amount
30034 27.25
30034 124
linq code
Dim ComputedData = From p In AllOrders _
Order By p.Field(Of String)("EmpCode") _
Group By Key = p.Field(Of String)("EmpCode") Into Group _
Select EmpCode = Key, _
Consump...
I have a Windows Service which exposes three sources of data via ADO.NET Data Services. These sources of data are read only XML files loaded into an XDocument and then exposed via .AsQueryable(); The sources contain fields with integer IDs which can be considered to be 'foreign keys' between the data sources.
My client consumes this dat...
I'm just started to read up on LINQ and I want to start incorporating it into my code. I know how to compute the sum of a DataTable's column by either "Foreach"-ing through the rows or by doing a compute.sum on the specific column. How do I do the equivalent with LINQ to DataSet?
...
Hi,
I want to translate LINQ expression tree to SQL statement and I don't want to write my own code for this.
Example:
var query = from c in Customers
where c.Country == "UK" &&
c.City == "London"
select c);
To
SELECT ... FROM Customers AS c WHERE c.Country = "UK" AND c.City = "London"
I know DataContext.Log, but I want to use:
quer...
I am a little ashamed to say that I have never used an ORM; as you may recall most of my career experience is hacking around with Classic ASP and the little .NET I do tends to be maintenance only.
For my own career as well as in preparation for a new project at work (done in .NET finally!) I'm looking at adding an ORM to my skillset - b...
I've got an algorithm that compares two sorted lists, and I'm planning to make it more LINQ-y.
My first question: is there anything like this in LINQ already?
If not, I'm planning on writing it as an extension method, something like this:
public static class SortedCompareExtension
{
public static IEnumerable<Pair<T, U>>
Co...
Hello all,
I wonder if there is an enterprise application sample, designed with Domain Model in the Business Logic layer and LINQ for the Data Mapper? I'm not so sure of how to use the UnitOfWork ability of LINQ to SQL in conjunction with business objects from the Business Layer.
Thanks,
Lucian
...
I'm using IQueryable<T> interfaces throughout my application and defer execution of SQL on the DB until methods like .ToList()
I will need to find the Count of certain lists sometimes -without- needing to use the data in the list being counted. I know from my SQL experience that a SQL COUNT() is far less work for the DB than the equival...
I have a method that gets a nested array as parameter:
Number[][] data
where Number is my very simple class that inherits from INotifyPropertyChange.
And then i have a statement like this:
double[] max = (double[])data.Select(crArray => crArray.Select( cr => cr.ValueNorm ).Max());
When I'm trying to watch it in the debugger it jus...
Hello.
I'm trying to bind the following enum
public enum CertificateTypes : byte
{
None = 0,
Original = 1,
AuthenticatedCopy = 2,
Numbered = 3
}
to a tinyint column on the database. However, when creating the SelectListItems and calling, for instance, Person.CertificateTypes.Original.ToString() I get this:
<option va...
Working on Maths problems, I'm very fond of LINQ to Data.
I would like to know if LINQ is smart enough to avoid a cast like .ToArray() when the IEnumerable I work with is already an array.
See example below:
/// <summary> Transforms an array of timeSeries into one ModelData. </summary>
public static ModelData ToModelData(this IEnumerab...