Questions tagged as 'linq'

2
answers

Join two items from an IList in a single item by the Id

In my class it has: Id Venda Devolucao I have IList of this class, and in this IList has [0] classe Id = 100, Venda = 230.00, Devolucao = 0; [1] classe Id = 100, Venda = 0, Devolucao = 50.00; [2] classe Id = 101, Venda = 5...
asked by 08.06.2016 / 22:32
3
answers

LINQ Anonimous Type as parameter

I am trying to create a method that receives an anonymous type (see LINQ) (Please correct me if the term tipo anônimo (anonymous types) is incorrect) MinhaLista (produtos.Select(p => new {p.Id, p.Estoque}) I asked Visual...
asked by 06.01.2016 / 02:14
1
answer

Convert SQL script to Linq

I need to convert the SQL script below to Linq. SELECT [ID_Pessoa], [ID_ArquivoPagamento], SUM([Peculio_Valor]) AS 'Peculio_Valor' FROM [VW_PESSOA] WHERE [ID_Pessoa] = @ID_Pessoa AND [ID_ArquivoPagamento] = @ID_Arq...
asked by 08.12.2015 / 19:03
2
answers

LINQ Group By with multiple fields

I'm trying to return fields after a join between collections, but I'm getting the following error:    foreach statement can not operate on variables of type   'AnonymousType # 1' because 'AnonymousType # 1' does not contain a public   definit...
asked by 03.09.2015 / 22:41
1
answer

Default value for column of type Datetime

I have a table that has the DataRegistro field of type Datetime . I am using EntityFramework to generate the database ( I am not using the code first ) and I am adding the Computed property so that the column is populated automati...
asked by 01.09.2015 / 03:52
2
answers

String for KeyValuePair using LINQ

I'm getting a string in the format "N1N2S3S4L5L6O7O8X" and needs to be passed to a KeyValuePair or a NameValueCollection . Where the key is the letter and the number the value. { N, 1 } { N, 2 } { S, 3 } How to do this using...
asked by 26.06.2017 / 16:12
1
answer

Expression inside a lambda gives error

I created a lambda and tried to create one or one expression or another. With or (||) did not work. There, instead of || I've been adding Where. That's right? This is it now: var resultado = db.T_CRM_StatusPDV .Where(a => a....
asked by 30.05.2014 / 02:01
1
answer

Compare two lists of objects and pick up only the different [duplicate]

I'm having trouble comparing two lists of the same type List<Produto> in my product class I have the following structure. public class Product { public int IdProduct { get; set; } public String Name { get; se...
asked by 30.10.2018 / 13:50
2
answers

Problems with slowness SQL LINQ C # Entity FrameWork

I'm using Entity frameWork, I have a list of objects (data taken from the database) with Client data, public virtual DbSet<clientes> clientes {get;set;} public IEnumerable<clientes> FindAll() { db.Configuration.LazyLoadingEnabl...
asked by 06.11.2015 / 22:13
2
answers

Method To Receive Generic Values

Greetings. I have a method that gets 3 paraments: collection, business, quantity Collection: is a collection class that inherits from another class, eg, man, woman, senior ... Business: is a class that contains the methods that han...
asked by 09.05.2018 / 22:01