Most voted "lambda-expressions" questions
A lambda expression is an anonymous function that you can use to create delegates or expression tree types.
Learn more…305 questions
Sort by count of
-
2
votes1
answer704
viewsHow does Python handle common functions and internal Python functions?
I’m looking at Python’s dual functions compared to the common functions that use def to create them. See an example of a common function that converts a number to binary: def…
python function characteristic-language lambda-expressions python-internalsasked 5 years, 8 months ago gato 22,329 -
2
votes1
answer76
viewsCorrect use of lambda with filter()
Here is a practical example of a script that simulates a seller’s sales days and extracts only the days when the seller hit the day’s quota. The list represents the month (I entered only 3 days for…
-
1
votes2
answers771
viewsBring three possible results with Lambda
I need it in one expression to bring three possible outcomes. If date is up to 15dd, returns 1, if it is between 15 and 45 dd returns 2 and if it is larger than 45 returns 3. This is my lambda and…
-
1
votes1
answer1104
viewsJoin with lambda Expression only
With LINQ no problem. Now, how do I make a join with two or more tables? Below the attempt of the join that I couldn’t go through with. Two tables(T_Acao and T_ProximaAcao). Field in join is the…
-
1
votes1
answer2070
viewsAssign value to an object property by a list of objects
I have a list of objects: List. Well, this object has three properties, say, cnpj, acao and novaacao. I did a lick or lick and brought me all the results, let’s say two lines. I do a foreach on the…
-
1
votes2
answers147
viewsUse lambda with Ado.Net
Using sqldatareader and ado.net, can you use lambda with Linq or just lambda or just Linq? This is not a multiple question, but Lynx and Lambda are always together, so the various "?" okay?
-
1
votes1
answer129
viewsIn the table Insert is inserting everything, until what I do not want
When I give a savechanges(), records to all tables and would like just one. How do I do? Tables Acao and ProximaAcao also inserts record. public T_TarefaParceiro geraIdParceiro() { WEBEntities db =…
-
1
votes2
answers453
viewsRadiobutton or button to sort data
In my project, I have a Occurrences table and a column called Status and the Status values are: pending or solved. I need to sort the data and create a logic that in my view i have a button, or two,…
-
1
votes1
answer1041
viewsHow to create a Lambda expression with Group by and Order By
I’m having trouble creating a Lambda sentence with Group by and Order By Together. How to group by column Scope and Idescope, and sort by Idescope. Segue Sentença. public static List<Escopos>…
-
1
votes4
answers2214
viewsBring a Max(Date) with LINQ
I have this Linq: var resultado = ( from pdv in db.T_PDV from tarefa in db.T_TarefaParceiro.Where(trf => trf.CNPJ == pdv.CNPJ).DefaultIfEmpty() from parceiro in db.T_OsParceiro.Where(prf =>…
-
1
votes1
answer533
viewsHow to make a lambda in?
I have a function convertStringListaInt parameter String. Example : String: 1,2. I’m converting this string into a List of the kind convertStringListaInt_Result owned by number(whole). How can I…
-
1
votes1
answer546
viewsProblem loading data with Entity Framework using Include
I’m using the Entity Framework with the Mysql on my system and I need to make a specific query that includes a list of a type of Model (ApplicationUser), in this list each returned object has in its…
c# mysql asp.net-mvc entity-framework lambda-expressionsasked 9 years, 5 months ago Luiz Negrini 1,424 -
1
votes1
answer113
viewsLinq Return all records when ID is NULL
Consultation: retorno = tarefaRep.GetAll(c => c.status == 0 && c.id_empresa == idEmpresa && c.id_cliente.ToString().Equals(idCliente) &&…
-
1
votes1
answer373
viewsProblems with Lambda and Datetime consultation
Hello I have the following Actionresult code from my controller below: [HttpPost] [AuthorizedUser] public ActionResult Load(DateTime DataInicial, DateTime DataFinal) { var AcessoDominio = new…
-
1
votes1
answer48
viewsError with lambda and fields float
Every time I carry my lambda, I make that mistake: System.Invalidoperationexception: 'The specified cast from a materialized 'System.Double' type to the 'System.Single' type is not Valid.' This only…
-
1
votes1
answer71
viewsHow to use SUM in a string field by converting the value to int?
I have a table that has a field PA that is string, it stores a 10 digit number and I can’t change the type of it because it references another table. I’m trying to add this field like this: Int32…
-
1
votes1
answer49
viewsFilter query
To insert a filter in my query the command is in a repository and I want to insert a filter in it, it can be by name for example. Code: public IList < T > Consultar() { using(ISession session…
-
1
votes2
answers376
viewsSubconsulta in Lambda
I would like to do a sub-query today on SQL: SELECT intid as IDCliente, (SELECT TOP (1) int_EP FROM tbl_estagioprocesso WHERE (int_IDC = tbl_Admin.intid) ORDER BY int_ID DESC) AS int_EP FROM…
-
1
votes2
answers1579
viewsNOT IN in Inline using a sub-query
I am using as a basis the answer in: https://stackoverflow.com/questions/432954/not-in-clause-in-linq-to-entities I need to make a query where do not contain (NOT IN) the Ids coming from another…
-
1
votes0
answers35
viewsPerform sorting by a given field of a given table
I have the following syntax The instruction below perform sorting by field Lot Number table Lot var lvmLotes = db.Lotes.Tolist(). Where(x => x.DataAbate.Date == Search). Orderby(x =>…
-
1
votes1
answer1377
viewsLinq with 2 different context using Inner Join
I would like to make a query in 2 different databases (2 Dbcontext) I tried it in several ways, one of them: I make a prequery in Dbmega context to recover the employees var FuncionariosLinq = (from…
-
1
votes2
answers254
viewsFill Map without duplicating records
I own a List of an object A. In this object, I have 2 attributes: Long and a BigDecimal. How can I create a Map where the key will be Long and value will be the BigDecimal, using a lambda? The…
-
1
votes1
answer158
views.Orderby dynamically in Lambda
I have a field int called OrdemDosProdutosDestaque where I store products order preference (My customer choosing and storing in the database). ex: 1=Aleatório 2=Preço 3=Referência 4=Categoria etc..…
-
1
votes2
answers538
viewsAbout the structure of the Sorted function, how does it work?
The instruction below is done as many times as the vector size sub. What is the result of this instruction? sorted(sub, key = lambda x : size(x) ) Where x are the values from 0 to 31 inclusive and…
-
1
votes1
answer337
viewsEclipse Maven | lambda | use -source 8 or Higher to enable lambda Expressions
Java Maven project in Eclipse neon (4.6.0), simply does not compile when using lambda. The mistake: use lambda Expressions are not supported in -source 1.5 (use -source 8 or Higher to enable lambda…
-
1
votes1
answer235
viewsC# - Subselect in Lambda and Linq
How to mount the query below in Lambda and/or Linq? select emp.cd_empresa AS ID, emp.nm_razao_social + ' (' + emp.nm_fantasia + ')' AS EMPRESA, (SELECT COUNT(con.cd_consulta) from…
-
1
votes1
answer613
viewsHow to select using LINQ with 2 tables?
This is my select: bd = new AcessoBancoDados(); bd.Conectar(); string cidade = "SELECT c.Nome FROM Cidade c join Estado e on c.EstadoId = e.EstadoId WHERE e.Sigla = '" + dto.Estado + "'"; dt =…
-
1
votes3
answers712
viewsCompare string to Enum, inside the lambda?
the problem is: I have a dropdownlist loaded from an Enum, which can come with the null value of the screen. listaItensSolicitados = os.Site == null ? this.itemSolicitadoService.Consultar(o =>…
-
1
votes0
answers60
viewsRelate more than one column to lambda Expression
I have the query below that relates only the Processoid. I need to know how to relate processes and processes lists by Processoid and Grupoid. I have consulted in several groups and did not get an…
-
1
votes1
answer41
viewsHow to use a Serverless function from Cloudmqtt?
I’m trying to integrate Cloudmqtt Broker with an AWS Node.js serverless function but I can’t find any documentation on how to do it. The goal is when arriving a message in Broker it trigar a Lambda…
-
1
votes1
answer56
viewsincrement field with lambda
I need to insert an increment into a field that is the primary key of a table, but need to be selected by one more field and does not work, if use only with the primary key works. But I need to pass…
-
1
votes2
answers304
viewsPick all fields of a class using Lambda + Group By
I have a list: produtosCompletos = (from f in estoques join p in produtos on f.idProduto equals p.id join c in classes on f.idClasse equals c.id select new produtoCompleto() { idUnidade =…
-
1
votes1
answer670
viewsFilter with Linq or Lambda using Join and Group By
Good Afternoon In a table where it is always inserted new records may occur of having the same Date and the same Ratecode, however I want to get a list of this table but for each Date group,…
-
1
votes2
answers75
viewsHow to make an if in a select when creating an object?
I don’t know if the title is right, but the question is this:: listaAgendaDetalhe = (from a in listaAgenda join p in listaProfissional on a.idProfissional equals p.id select new agendaDetalhe() {…
-
1
votes3
answers227
viewsLambda python function
I’m trying to do a python lambda function that finds the largest element in a list that has length N. If you make the following code, you’d be right? maior = reduce((lambda x,y: x if (x > y) eles…
-
1
votes2
answers263
viewsHow to select the whole object, Lambda C#
I have a difficulty here in this lambda, I would like to know how I select the whole object without having to specify all its properties. Like a: SELECT * FROM Somethings Without having to specify…
-
1
votes2
answers587
viewsTurn a for into lambda with variable interaction
How to turn the section below into a Lambda code? The idea is to multiply the maxScore for i so that at each interaction it increases the number, only for the first 5 results. for(int…
-
1
votes2
answers137
viewsProperty error cannot be set to System.Double
I took that mistake: The 'Datalib' Property on 'Release' could not be set to a 'System.Double' value. You must set this Property to a non-null value of type 'System.Single' The thing is that I…
-
1
votes2
answers447
viewsFormatting numbers is not working
I have this line, where I need to format a field. I did several ways and nothing: lista.ForEach(e => e.Total = string.Format("{0:N}", float.Parse(e.Total))); and so lista.ForEach(e => e.Total…
-
1
votes1
answer502
viewsService is not being called to update the database
I did a job and when I call on URL, passing the appropriate parameters, does not work: Call on URL: http://localhost:9078/api/atualiza/1000012120/teste My service: public class AtualizaController :…
-
1
votes2
answers51
viewsFiltering through empty children
I have two entities (TipoDeRequerimento and TipoRequerimentoSituaçãoAcademica) in my query. Today I can make a filter to bring the Types of requirements that have a certain academic situation…
c# asp.net-mvc asp.net-web-api lambda-expressions linq-to-entitiesasked 7 years, 1 month ago Thiago Ubiratan 353 -
1
votes1
answer38
viewslambda error with Join when placing a Groupby
In this lambda, is giving error in select in t1 and t2. If placed Key says it does not recognize Totalliquido and the fields in t2. If removed Groupby works. public List<LiberacaoItensDTO>…
-
1
votes1
answer141
viewsdoubt expression Innuendo, clause IN
I have the following expression retorno = (from ven in context.VendaModel select new { ven.barras, ven.data, ven.valor }).ToList(); I need to search only what you have on a list that will be passed…
-
1
votes1
answer156
viewsDuplicate data on datagrid
I am developing an application in WPF and when I fill the datagrid via code it returns the duplicate value. I am using Entity Framework. XAML <DataGrid x:Name="dataLocal" Margin="10,111,11,10"…
-
1
votes2
answers120
viewsLambda expression to return a Person in the repository - DDD and Aspnet.Core
I have a table Person who has one-to-one relationship with the tables PessoaFisica and PessoaJuridica. When I pass the id, it has to check me if nature is physical or legal and bring me the person +…
-
1
votes1
answer751
viewsCS0266 error Cannot convert implicitly
When trying to make a list where you will filter only the 5 largest records by values in descending order I am experiencing this error: CS0266 error Cannot convert type implicitly…
-
1
votes1
answer79
viewsJava: Problems using lambda expressions in generic Listing method
The problem would be that I cannot multiply the variables that return from Listing using lambda (e*e), it keeps asking to create a Listing method using Object, but using Generics. I appreciate any…
-
1
votes2
answers452
viewsLINQ (LAMBDA) How do I add another list of objects to my Where? c#
Good afternoon, I’m running a C# Net Core application, using lambda for database context handling. I have one question, and that is: I have a list of objects with these two attributes: Name and…
-
1
votes2
answers137
viewsShow Groupby List using Lambda in view. ASP.NET MVC
Well, I’m having a little bit of a problem here. I consult at the bank using Lambda, and use the tag GroupBy,query is bringing objects correctly, the problem, is that I can’t show in view. gives an…
-
1
votes2
answers89
viewsRename field in a lambda
In SQL I do so: select campo1 as teste from tabela And in a lambda? How would I do? I have this lambda with several tables and the field ValuePayment is repeated several times. var qry =…