Stories recently tagged with 'Lambda'

Getting Started with LINQ - Part 2 (Language Enhancements)(beyondrelational.com)

submitted by DPalkarDPalkar(228) 2 years ago

In my previous post I summarized Microsoft Language Integrated Query (LINQ). Briefly discussed about its components as well as showed some code examples to highlight the sql query type syntax it uses. When we talk about LINQ, we are talking about number of little features that were added in .net 3.0 framework which are the building blocks of the LINQ. In this post I will discuss these features a little further as follows. Object Initializers Collection Initializers Anonymous Types, Implicitly Typed variables (var keyword) Lambda Expressions Partial Methods Extension Methods read more...

1 comment |category: |Views: 258

tags: another

Getting Started with LINQ(beyondrelational.com)

submitted by DPalkarDPalkar(228) 2 years ago

In this we’ll continue to discuss how to go about the SQL Server Data Access using various technologies. This post will discuss Microsoft Language Integrated Query, otherwise known as LINQ. I will discuss how it can be used to accomplish the same tasks we have discussed in previous posts. But before that it surely requires a good introduction to start with. LINQ was introduced with .net 3.0 as one of the language enhancements. It uses generics, which was introduced in .net 2.0, thoroughly to accomplish what it was designed to do. LINQ is designed to query virtually any kind of data source which implements IEnumerable<T> interface. It allows you to query the data by emulating the SQL query expressions using any .net language you are comfortable with. Isn’t that amazing!! read more...

add a comment |category: |Views: 346

tags: another

Beef up params in C# 5 to solve Lambda Abuse(www.kodefuguru.com)

submitted by KodefuGuruKodefuGuru(2818) 2 years, 1 month ago

C# 4 introduced named and optional method parameters, which does a fine job of cleaning up method overloads. But a piece of the puzzle was left out. The params keyword could have been combined with named parameters to make it even stronger and address issues others have overcome by abusing other language features. To be fair, params works great with optional parameters. However, it is nearly unusable with named parameters. read more...

add a comment |category: |Views: 14

tags: another

GroupBy and Average with Lambda Expressions(digitalpropulsion.org)

submitted by panicpanic(35) 2 years, 7 months ago

I was recently tasked with generating a string of averages based on a list of business objects. The business object has a string property called VehicleName and a decimal property called StandardMpg. The averages needed to be calculated per VehicleName, so this is to be what I group on. read more...

add a comment |category: |Views: 217

tags: another

Stretching Lambda’s Legs: Single Statement String Concatenation(goneale.wordpress.com)

submitted by gonealegoneale(1055) 3 years ago

So let’s get started, supposing you wish to compile a list of song titles separated by a comma, ordinarily you would for each loop them, then assign the comma as “, “ on the second iteration. Well, I wanted to get tricky of course... read more...

add a comment |category: |Views: 42

tags: another

System.Linq.Enumerable.All - Better Know an Extension Method Part 2(bleevo.com)

submitted by bleevobleevo(245) 3 years, 3 months ago

Learn how to harness the power of "All" a powerful new extension method brought to you by System.Linq read more...

add a comment |category: |Views: 258

tags: another

System.Linq.Enumerable.Aggregate - Better Know an Extension Method Par(bleevo.com)

submitted by bleevobleevo(245) 3 years, 3 months ago

Learn how to harness the power of Aggregate a powerful new extension method brought to you by System.Linq read more...

add a comment |category: |Views: 327

tags: another

When would you use delegates in C#?(blog.decayingcode.com)

submitted by arch4ngelarch4ngel(585) 3 years, 3 months ago

This is a valid question. Before C# 3.0, you could use delegates or declare full methods to bind to events. Now we can declare event directly through lambda. Delegates is a keyword that can be used to declare inline methods. This inline code can be stored inside variables and then executed when necessary. This is exactly what happens when you are binding methods to events. read more...

add a comment |category: |Views: 17

tags: another

Sweet lambda trick to append to MVC SelectList()(goneale.wordpress.com)

submitted by gonealegoneale(1055) 3 years, 3 months ago

Well I was thinking of an ill-tricky way to append a string to the beginning of each list item in ASP.NET MVC’s SelectList collection, tell me if this might help you... read more...

add a comment |category: |Views: 740

tags: another

Code Snippet: Filtering a list using Lambda without a loop(blog.decayingcode.com)

submitted by arch4ngelarch4ngel(585) 3 years, 4 months ago

Quick code snippet to remove some loops inside your code and increase visibility inside your methods. read more...

add a comment |category: |Views: 15

tags: another

Creating a StreamProxy with Delegate/Lambda to read/write to a file(blog.decayingcode.com)

submitted by arch4ngelarch4ngel(585) 3 years, 4 months ago

I was once asked "What is the use of a delegate?". The main answer that I found was "to delay the call". Most people see delegate as events most of the time. However, they can be put to much greater use. Here is an example that I'll gladly share with you all. read more...

add a comment |category: |Views: 15

tags: another

Custom logic in C# automatic properties(blog.somecreativity.com)

submitted by dnksiddnksid(355) 3 years, 6 months ago

The article tries to make an argument in favor of having support for introducing custom-logic with automatic properties in C#. It also shows a possible solution and asks for ideas for refinement. read more...

add a comment |category: |Views: 72

tags: another

Avoiding Inheritance Dependencies Using Generics and Lambdas(managed-world.com)

submitted by samuel_d_jacksamuel_d_jack(415) 3 years, 10 months ago

A nice implementation of the Command pattern using generics and lambdas read more...

add a comment |category: |Views: 38

tags: another

C# methods decoration using lambda expressions(nextension.blogspot.com)

submitted by NextenderNextender(20) 4 years, 1 month ago

On regular basis several repeating code blocks appear in projects source code. Wouldn't it be great if we could just say: here is my method, do call within TCF block ("try - catch - finally" block) first time I need it, but I may require to call it with "try - catch" block only next time or with other catch block content (say I had logging there, but decided to remove or replace it for some special cases of this method call): // Like this return MyMethod1.TCF(ex => Log(ex), arg => DoSomeFinallyAction(arg))(arg); read more...

add a comment |category: |Views: 67

tags: another

Consuming Lambdas Using Funcs and Actions(squaredroot.com)

submitted by TroyMGTroyMG(2670) 4 years, 3 months ago

There have been a lot of articles about how to pass a lambda expression into a method, but how do I create a method that accepts one? Read on to explore your lambda consuming options. read more...

1 comment |category: |Views: 10

tags: another

Get Ruby-esq Each Iterators in C# 3.0(stevenharman.net)

submitted by usshermussherm(5285) 4 years, 4 months ago

An Extension Method that will shine a little Ruby-goodness on your hum-drum C# world - bringing Ruby's .each method to IEnumerable. Iterators, lambda methods, and solubility! read more...

add a comment |category: |Views: 13

tags: another