Click here to Skip to main content
15,891,316 members
Everything / Lambda

Lambda

lambda

Great Reads

by Ivan Perevernykhata
How to start/stop RDS instances on schedule with aws-sdk, nodeJs Lambda function and CloudWatch
by JIANGWilliam
This is the first of three episodes to introduce considerations and techniques used for the throwable functional interfaces defined in my open-sourced library functionExtensions.
by Randy Kroeger
Created a POC that dynamically builds a predicate using Expression and Reflection.
by Pradip Koli
Using NoSQL DBreeze database with ASP.NET on SQL Northwind Database.

Latest Articles

by P. Erward
How to put the AWS Lambda C++ Runtime into a Lambda layer and how to use it
by egoebelbecker
Create an AWS Lambda in five minutes
by Necmettin Demir
To provide a URL link to access objects in private S3 bucket through AWS Cognito User Pool (using hosted UI), Authorized API Gateway and Lambda in a Secure Way.
by PaulKukiel
Build a Custom PHP MVC in 30 mins and deploy to AWS lambda

All Articles

Sort by Title

Lambda 

30 Nov 2013 by agent_kruger
i would like to know the concept of Delegates and lambda.Example code will be appriciated. Thanks In Advance.
30 Nov 2013 by OriginalGriff
If you have "refered many google links" then what do you expect us to tell you that you haven't found? Especially in a little textbox like this?Go back to Google, and look again: it contains a huge amount of information on the subject which will better answer a general question such as this.
30 Nov 2013 by Karthik_Mahalingam
Try these linkmight be useful for you.C# Delegates, Anonymous Methods, and Lambda Expressions – O My![^]this link contians basics of lambda very informative...
7 Dec 2012 by Rahul Rajat Singh
This article discusses delegates and how to write delegate handlers using functions, anonymous functions and Lambda expressions.
9 Jan 2013 by Bruce Hsu
Hi all...Recently I try to access another member function in the same class of lambda expression. (VS2010)The skeleton of my program looks like this:class CMyWnd : CDialog { ... void OnMsg(void) { ... GetDlgItem(IDC_CTRL)->EnableWindow(FALSE); ... }};Then I...
9 Jan 2013 by Jochen Arndt
When using similar names in different scopes, at least one must be prefixed. Because you are implementing code inside class declarations, you must use this here. Imagine that the code is inline and the code block is copied as-is to the location where the function is called before compilation...
10 Jan 2013 by H.Brydon
You might be running into problems with access. The first line of your class isclass CMyWnd : CDialog {and it should probably beclass CMyWnd : public CDialog {
2 Jan 2013 by Bruce Hsu
Hi, AllRecently I try to use std::function and Lambda expression to simply my code.However there are some weird problems.#include #include #include int main(int argc, char *argv[]){ std::function arr[]={ [&](int n)->bool...
16 Oct 2019 by Jahan Alem
I've faced a problem that is:An exception of type 'System.ArgumentException' occurred in EntityFramework.dll but was not handled in user codeAdditional information: The Include path expression must refer to a navigation property defined on the type. Use dotted paths for reference...
26 Jan 2015 by Abhinav S
You can debug and check exactly where the error occurred and what caused it.That would be the easiest way to find the error.
16 Oct 2019 by Member 14624871
An exception of type 'System.ArgumentException' occurred in System.Web.Optimization.dll but was not handled in user code
14 Aug 2014 by TheCannyCoder
Java 8 is perhaps one of the most exciting editions of the Java language in recent times. One of the headline features is support for functional programming which is the focus of this blog. The support comes mostly in three features: Support for [work pipeline] streams. Streams allow us to process d
23 Feb 2023 by Hasitha Wijesooriya
I am trying to run my lambda project in Asp.net Core. I attempted several solutions but received the same error. FileNotFoundException: Could not load file or assembly 'File Processing, Culture=neutral, PublicKeyToken=null'. The system cannot...
31 Dec 2012 by John Bandela
This post discusses another alternative to lambda move capture.
12 Nov 2013 by John Pravin
Asynchronous Programming with Task Parallel Library.
12 Feb 2020 by OwenDavies
A fix for people experiencing the same issue with AutoMapper 3.2.1
16 Jun 2017 by komakommander
Hi everyone,i am banging my head on the following task:I have an AzureFunction that uses a ServiceBus-Trigger like so:{ "bindings": [ { "name": "myQueueItem", "type": "serviceBusTrigger", "direction": "in", "connection": "MyConnection", ...
16 Jun 2017 by Gurdeep
Your problem clearly lies in the difference between these lines: var content = Encoding.UTF8.GetBytes("Some string"); ByteArrayContent postContent = new ByteArrayContent(Encoding.UTF8.GetBytes(message)); Why use the ByteArrayContent?
20 Oct 2018 by Member 13974276
I have two tables as shown below Table 1 - LR ID___________Name 1 A 2 B 3 C Table 2 - Mapper ID___________LRID 1 1 2 1 3 2 The Mapper table refers LR table. I am trying to get the data from LR table wherever the IDs...
20 Oct 2018 by OriginalGriff
This is one of the most common problems we get asked, and it's also the one we are least equipped to answer, but you are most equipped to answer yourself. Let me just explain what the error means: You have tried to use a variable, property, or a method return value but it contains null - which...
2 Sep 2017 by jeAntoni
I have a list My Requirement I need a LINQ lambda query to Group to a list if a Condition meets else do not group. i.e On a condition I want it to be grouped else it should not be grouped I have searched net - I get details on grouping on condition and I couldn't get and understand on...
1 Sep 2017 by Graeme_Grant
Something like... var resultantList = sigList .Where(x => !string.IsNullOrEmpty(x.SignalGroup)) .GroupBy(s => s.SignalGroup) .Select(grp => grp.ToList());
1 Sep 2017 by Andy Lanng
More like: var resultantList = sigList .Select((x,i) => new {Item=x,Index=i}) .GroupBy(a => string.IsNullOrEmpty(a.Item.SignalGroup)?a.Index.ToString():a.Item.SignalGroup) .Select(grp => grp.Select(a=>a.Item).ToList()); Let me break it down: You want to have each empty string in...
2 Sep 2017 by jeAntoni
I got the below and it works as expected var resultantList = sigList .GroupBy(s => s.SignalGroup == "" ? s.SignalID.ToString() : s.SignalGroup) .Select(grp => grp.ToList()) .ToList();
20 Aug 2017 by jeAntoni
I have 2 Lists ListOne ==> ID , Name, Value ListTwo ==> ID, Desc, Value Expected Values of ListOne [1,A,200] [1,A,300] [1,A,520] [2,B,300] [2,B,350] [2,B,400] [3,C,40] [3,C,20] Values of ListTwo-Master Data [1,Analog,500] [2,Benefit,310] [3,Chain,50] My Requirement I want to get a list(say...
20 Aug 2017 by Graeme_Grant
Here are two different ways of doing it: 1. Standard Query var resultantList = from item1 in list1 join item2 in list2 on item1.Id equals item2.Id where item1.value
1 Dec 2017 by Jon McKee
How to do it and why it works
30 Apr 2013 by User 583852
I want to do something like thistemplate T& {val++; return val;} >class RangeAllocator...where IncrementorT is a user replaceable functor that RangeAllocator will use to increment values. I know I can do it using a struct but I'm...
1 May 2013 by jsolutions_uk
I'm not sure it is possible with lambdas, it's looking rather like a polymorphic lambda. check here[^]. I just don't think lambdas were intended to be used in the context of template based generic programming.The closest I have managed to get to implementing what you have above is...
1 May 2013 by Stefan_Lang
I know you can use functions as template parameters[^]. I suppose it could work with lambdas, but I have not tried myself.
6 Nov 2021 by Richard MacCutchan
Sorry no. This site does not provide free code conversion services.
14 Aug 2014 by TheCannyCoder
Reductions and Short-Circuiting Operations
12 Aug 2016 by misaqyrn9677
Hello I want Convert Below Code To Linq & Lambda Please Help Meselect Section, COUNT(*) from HealthyMap GROUP BY SectionregardsyarianWhat I have tried:In Entity FrameWork By C#Linq To Entity
12 Aug 2016 by Karthik_Mahalingam
try thisvar result = YourList.GroupBy(k => k.Section).Select(grp => new { Section = grp.Key, Count = grp.Count() }).ToList();
29 Dec 2015 by Peter Carrasco
This article describes a pub-sub model using AWS Lamdba along with SNS to keep your AWS-hosted RDMB system of record and cache in sync.
8 Nov 2014 by Mahdi K.
A detailed description for Delegate, Func, Predicate, Action and Lambda Expression.
24 Nov 2020 by PaulKukiel
How to build and deploy a Typescript lambda function with AWS CDK and Deno layer
3 Jun 2020 by Jeremy Likness
A primer on using LINQ to wring strongly typed queries directly in code
29 May 2014 by Randy Kroeger
Created a POC that dynamically builds a predicate using Expression and Reflection.
16 Oct 2014 by GateKeeper22
I am have a problem with Dynamically generated compared to a regular lambda expression in code. Below is the code that I use to generate a dynamic lambda.Dynamic Lambdavar parameterExp = Expression.Parameter(typeof(T), "x");var propertyExp = Expression.Property(parameterExp,...
15 Jan 2015 by Bhushan Mulmule
This write-up will take you through all the steps that are required to understand lambda expression thoroughly.
4 Dec 2012 by sadomovalex
Shows how using reverse engineering feature developers may add new conditions into string CAML queries using lambda expressions.
2 Oct 2022 by egoebelbecker
Create an AWS Lambda in five minutes
8 May 2018 by JIANGWilliam
This is the first of three episodes to introduce considerations and techniques used for the throwable functional interfaces defined in my open-sourced library functionExtensions.
9 Jun 2014 by Prasaad SJ
I m using EntityFramework to get the data from the DB. consider I have a tableBuyer{ guid id, datetime date, guid userid references user(id)}user{ guid id, string name}consider the above class as table in DB.I want to return user name in buyer list....
10 Jun 2014 by goathik
I had the same problems concerning the use of includes slowing down my linq performance.To solve that problem I had use "select new" on linq to manually populate the properties I needed (User.Name, on your case) into a partial class having the same name (Buyer) and namespace of the class in...
15 Aug 2016 by yarian misaq
select Stage, COUNT(*) from HealthyMap Where Section = '" + cmbSectionGPA.text + "' GROUP BY Stage"I Want Convert This Query To LambdaPlease Help MeRegardsYarianWhat I have tried:Helping To Convert Query To Lambda In C#
15 Aug 2016 by Karthik_Mahalingam
var result = YourList.Where(k => k.Section == cmbSectionGPA.text).GroupBy(k => k.Stage).Select(grp => new { Stage = grp.Key, Count = grp.Count() }).ToList();
2 May 2015 by fahd951
Hi there,First thank you to visit my post ..I just start my way with Linq so I'm sorry if it's stupid question :(I have this ERD design ..http://www.m5zn.com/newuploads/2015/05/02/jpg//6fe7a5567905df0.jpg[^]also I wrote this...
4 May 2015 by Maciej Los
Have a look here:101 LINQ Samples[^]LINQ - Sample Queries[^]How to: Use Lambda Expressions in a Query (C# Programming Guide)[^]Lambda Expressions (C# Programming Guide)[^]
20 Oct 2021 by User 15041314
{ "message": "The operation was successful.", "code": 200, "fileDetailResponseDtos": [ { "phoneNumber": "550000000", "textMessage": "Message1", "createDateTime": "2021-10-20T15:45:27.277", "sender": "Anar", ...
13 Apr 2015 by bkashani
Hello I have this sql command Could you help me How can I write this with lambda expression?Select A.*from Tablename A inner join (select address,state from Tablename group by address,state having...
13 Apr 2015 by Maciej Los
Try this:var qry = TableA.AsEnumerable() .GroupBy(a=>new{a.address, a.state}) .Where(grp.Count()>1) .Select(d=>new{address=d.Key.address, state=d.Key.state});
16 May 2020 by Member 14169626
In terms of performance, I want to do using contains instead of where. How can I create the query below without using contains? var t=myentities.Employee.WHERE(x=>x.EmployeeID ==123 && myList.Any(y=>x.BranchID.Contains)).ToList(); What I have...
16 May 2020 by phil.o
These are not the same thing. Where expects a predicate as argument which is used to filter the items in a collection, and returns a filtered enumeration. Contains expects an item as argument and returns true or false depending on whether the...
14 Mar 2022 by HRVP
I have one model MaterialModel ID Material 1 MaterialZZZ 2 MaterialYYY 3 MaterialXXX 1 MaterialABC 2 MaterialKKK 2 MaterialVVV 5 MaterialMMM Expected Result (Result Model) ID Count 1 2 2 3 3 1 5 1 I want to group by and take the...
14 Mar 2022 by Luc Pattyn
static void Main(string[] args) { List items=new List(); items.Add(new Item(1, "zzz")); items.Add(new Item(2, "yyy")); items.Add(new Item(3, "xxx")); items.Add(new Item(1, "abc")); items.Add(new Item(2, "kkk"));...
14 Mar 2022 by Maciej Los
Take a look at below code: void Main() { List mm = new List() { new MaterialModel(){ID = 1, Material = "MaterialZZZ"}, new MaterialModel(){ID = 2, Material = "MaterialYYY"}, new MaterialModel(){ID = 3,...
4 Jul 2015 by deepakdynamite
I have list of information with following fields:Project State Title ABC Resolved Title1 ABC Pending Title2 DEF Archived Title3 DEF Resolved Title4 DEF Committed Title5 DEF Active Title6I want...
4 Jul 2015 by FranzBe
void Main(){ List objItems = getSampleData(); // for linqpad objItems.Dump(); var result = objItems.GroupBy(x => new { x.Project, x.State }) .Select(g => { var a = g.ToList(); return ...
14 Sep 2014 by Simba Mukodzani
I have a piece of code like the following....Delegate Function CreateObject(Of I)(Object context) As IClass Container Property ReadOnly ObjectType() As TypeEnd ClassClass Container(of I) Inherits Container Property ReadOnly Creator() As CreateObject(Of I)End...
12 Jul 2019 by Patrick Skelton
This is a follow-on to another question I asked here: https://www.codeproject.com/Answers/5162098/How-do-I-convert-this-LINQ-query-to-function-synta#answer1 I am generating the XML I require using the following code: bool includeDetails = true; XElement breakdown = new XElement ( "Breakdown",...
12 Jul 2019 by Richard Deeming
As discussed in the comments, the code you've shown is correct, and the bug has now disappeared. Demo: Optional Xml | C# Online Compiler | .NET Fiddle[^]
7 May 2019 by Member 14087498
Hi, I just was wondering if I can perform a Query just like that: What I have tried: List = _context.StudentClass .Where(sc => sc.ClassId == 1) .ToList(); List studentIdList = new List(); foreach (var student in...
6 May 2019 by OriginalGriff
Well, you could ... if you got the names right, C# is case sensitive ... but it wouldn't do much that was useful. The assignment inside the loop means that the eventual result will be the final result only, because it "throws away" all previous results each time round the loop. You might want...
6 May 2019 by Christian Graus
Just to add, you need to include the Linq namespace for that stuff to start working, otherwise you'll have a List class but not those operators List studentIdList = new List(); Also, this makes no sense. Set it to null if you need to set it inside a scope. Your code sets it over...
6 May 2019 by Maciej Los
This piece of code is not clear to me: List studentIdList = new List(); foreach (var student in studentClassList ) { studentIdList = _context.Student.Where(st => st.Id == student.StudentId).ToList(); } If you would like to get list of students in a specific class, you should do...
7 May 2019 by BillWoodruff
To me this kind of code ... that will obviously not compile ... indicates you have not really studied the basics of using the powerful tools that Linq provides. Don't worry, though: everyone I know has gone through a learning curve to get somewhat fluent in using Linq :) Well, okay, imho,...
1 Nov 2014 by Member 11180545
helloHow do I repeat phrases when loading data from the database don't show to control of drop down listplz help memy code is var JensKakhat = db.ItemProducts.Where(c => c.ForProductId == DdlProduct.SelectedValue.ToString()).ToList();int count3 = JensKakhat.Count();if (count3
1 Nov 2014 by DamithSL
var result = JensKakhat.GroupBy(g => g.Id) .Select(g => g.First()) .ToList();PnlTypePaper.Visible = result.Any(); DdlTypePaper.DataSource = result;DdlTypePaper.DataTextField = "ItemNine";DdlTypePaper.DataValueField =...
12 Apr 2017 by Patrick Skelton
I think this question might be stupidly simple, but I'm new to lambdas and just can't work out the syntax for the following (or if it is even possible). Is is possible to rewrite the following code fragment using an inline lambda in the Thickness constructor? double visualUnits = 0.0;...
12 Apr 2017 by Richard MacCutchan
Quote: they won't even compile. Then that should give you a clue. I don't think there is anything to be gained from over complicating a constructor. See lambda expressions - Google Search[^].
12 Apr 2017 by Patrick Skelton
It seems, as has been commented, I was over complicating this. It doesn't require a lambda at all. The following 'standard' C# syntax works fine: Padding = new Thickness( 10.0, ( Device.RuntimePlatform == Device.iOS ) ? 20.0 : 0.0, 10.0, 5.0 ); I knew the question was probably stupidly...
30 Aug 2019 by Member 14169626
I want to use entity lambda query and insert table.But I dont choose same area.How to select and where condition this area. SCHOOL TABLE SCHOOL ID // CLASS ID // CLASS NAME 1 1A 1 1 1B 1 1 1C 1 1 1D ...
29 Aug 2019 by Gerry Schmitz
.Where(s=>s.CLASSID). This where goes nowhere. And not much else.
9 Jun 2022 by Giuseppe Di Palma
I wrote a telegram bot with aws lambda. I have an Api gateway endpoint which runs the event and triggers the lambda function. Now the problem is that I can't get the "body" because it always returns the same error. This is the request I can get...
23 Nov 2023 by Mike Breeden
In the past I've been able to be very creative using AJAX in ASP.Net websites, particularly for Intranet Applications. I've been exploring AWS Lambda/Serverless websites which have a great cost advantage, etc. Apparently you cannot use AJAX...
5 Apr 2016 by Patrick Skelton
Hi,I am a little confused by the System.Threading.Timer class. The following code compiles and runs fine:using System;using System.Threading;namespace ConsoleApplication1{ public class Repeater { public Repeater( Action callback, object state ) { // Timer...
5 Apr 2016 by Patrick Skelton
I am not sure if it is the only or best solution, but the following code achieves what I was looking to do. Basically, all I have done is changed the "dumb" integer _count variable to a class, which means it is passed by reference and it can maintain its own internal state, like this:using...
8 Jan 2020 by Member 14169626
Public void List() { string x=""; foreach( var item in t) { x= .... } } I want to write the string values ​​in my hand in lambda. But when I write as where I get an error. What I have tried: var c=MyStudent.tblStudent.Select(x=>x.tblPerson).Distinct().ToList(); I want to where...
8 Jan 2020 by OriginalGriff
Where requires a condition, perhaps something like this: var c=MyStudent.tblStudent.Where(x => x.Contains("John")).Select(x=>x.tblPerson).Distinct().ToList();
8 Jan 2020 by Maciej Los
Seems you want to create a where statement dynamically. So, please read this: How to use expression trees to build dynamic queries (C#) | Microsoft Docs[^] Here[^], you you'll find quite simple example.
15 Jul 2016 by Troy Bryant
Hi -I'm looking to rewrite this query in linq and literally have no idea. In my application I have strongly typed view models so dont know if using annomous types as a few of the articles have stated.Here is the sql : select...
15 Jul 2016 by Vignesh Mani
var queryNestedGroups = from student in students group student by student.Year into newGroup1 from newGroup2 in (from student in newGroup1 group student by student.LastName) group newGroup2 by newGroup1.Key;
13 May 2013 by Mohammed Hameed
Ideally, how many lines of code (max) should be written in a Linq/Lambda expression?Thanks!
13 May 2013 by Code-Hunt
https://www.simple-talk.com/do...
17 May 2013 by Andre T.G.
In keeping with the warmth and fuzziness of functional programming, your code should be only as large as it needs to be, or in other words your linq expression should be as succinct as possible. If it isn't, split it up into a number of expressions. ATG
21 May 2022 by Necmettin Demir
To provide a URL link to access objects in private S3 bucket through AWS Cognito User Pool (using hosted UI), Authorized API Gateway and Lambda in a Secure Way.
6 Dec 2014 by mukesh mourya
SELECT [t0].[Id], [t0].[Challan_No], [t0].[Type], [t0].[Measurement], [t0].[Update_By], [t0].[Date], [t1].[Id] AS [Id2], [t1].[Challan_No] AS [Challan_No2], [t1].[Own_Comany], [t1].[Parti_Name], ...
6 Dec 2014 by Joezer BH
You may use Linq2Sql's DataContext.GetCommandDbCommand dc = db.GetCommand(TheQeury);Check out the msdn article on the method[^][added]ORSee linqpad[^] (as suggested by Eliyahu in the thread above, I am not sure what the "lightweight" free version includes...
11 Dec 2014 by mukesh mourya
var result = dm.Challan_Totals .Join(dm.Challans, ct => ct.Challan_No, c => c.Challan_No, (ct, c) => new {...
9 Aug 2015 by JayantaChatterjee
I have an object-model "MovieInfo" class, which have the property "cast". here cast is a List of string values.I want to get all the cast name from list and add it to comboBox items..So, I tried:List paraMovies=BLLMovies.MoviesManipulation.MoviesList;...
9 Aug 2015 by Mehdi Gholam
Start here : http://www.c-sharpcorner.com/UploadFile/0f68f2/programmatically-binding-datasource-to-combobox-in-multiple/[^]
9 Aug 2015 by DamithSL
use SelectManyparaMovies.Where(m=>m.Cast.Any()).SelectMany(m=>m.Cast).ToArray()
9 Aug 2015 by sreeyush sudhakaran
Tried DamithSL solution and seems works fine :)using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.IO;namespace...
13 Nov 2015 by Maniraj.M
Hi all,i having a code like this and iam binding that string value to dropdownlist. string test = ds.Tables[0].AsEnumerable().Where(x => x.Field("Id") == lbl.Text).Select(z => z.Field("Description")).ToString();Drpdwn.Items.Add(test);but when execution it binds like this, ...
11 Nov 2015 by Krunal Rohit
Loops through the collection and add it to the dropdown items.var items = ds.Tables[0].AsEnumerable().Where(x => x.Field("Id") == lbl.Text).Select(z => z.Field("Description")).ToList();foreach(var i in items){ Drpdwn.Items.Add(i.ToString());}-KR
19 Feb 2018 by Richard MacCutchan
python aws lambda - Google Search[^]
28 May 2015 by Member 11581003
I have a table that stores Referral details - it includes fields like Referral Type, Referral Date, OffenderID, OfficerID etc.) And obviously some Offenders are referred more than once (multiple times) and likewise, OfficerID also repeats in the table as many offenders are referred by the same...
28 May 2015 by Sascha Lefèvre
To give you a fully working query I would have to know how your Offender- and Officer-Tables/Entities look like. So I'll make a good guess here instead and to illustrate I include all the code I wrote to test it. You obviously can discard everything except the query at the bottom. I assume...