Stories recently tagged with 'Delegate'

Using Async Delegates instead of the Thread class(jachman.wordpress.com)

submitted by JachmanJachman(530) 3 years, 1 month ago

If you want to write some asnychronous code, the good old fashioned way is to create a new Thread. But this has several pitfalls, e.g. when you need to use parameters or you need to retrieve a return value. Then this way is getting tricky. read more...

add a comment |category: |Views: 33

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

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

Get Your Func On(codebetter.com)

submitted by peter.morlionpeter.morlion(45) 3 years, 10 months ago

Using Func<T> and delegates for code decoupling. read more...

add a comment |category: |Views: 25

tags: another

Create elegant code with Action delegate and List.ForEach method(dotnettipoftheday.org)

submitted by manovichmanovich(755) 4 years, 6 months ago

Small example of how to use Action delegate to perform some action on all elements of a collection. read more...

9 comments |category: |Views: 645

tags: another

C#: Care about Event Memory Leaks with Delegate.GetInvocationList()(weblogs.sqlteam.com)

submitted by spirit1spirit1(3160) 4 years, 7 months ago

Subscribed events are one of the most common reasons of memory leaks in .Net. This means that if you have an object that has an event and there are other object that are subscribed to that event, the original object won't be properly disposed until all events are unsubscribed since an event is a strong reference. read more...

2 comments |category: |Views: 421

tags: another

Pluck Me!(panteravb.com)

submitted by chrcar01chrcar01(560) 4 years, 8 months ago

Fun with Generics and Arrays and Delegates read more...

8 comments |category: |Views: 0

tags: another

The Power of the Predicate<T>(randypatterson.com)

submitted by jsmithjsmith(160) 4 years, 8 months ago

The very flexible generic collection List<T> contains several methods that take a predicate as it's parameter. Coupled with Anonymous Methods this provides powerfully concise code for filtering, searching and sorting your collections. read more...

1 comment |category: |Views: 262

tags: another

The Action Delegate(jeremyjarrell.com)

submitted by jeremyjarrelljeremyjarrell(2685) 5 years, 2 months ago

Did you know that by using the Action delegate we can define a single operation which will automatically be applied to every member of an array? This is a great way to make your code cleaner and more elegant, read more...

add a comment |category: |Views: 37

tags: another

The Action Delegate(jeremyjarrell.com)

submitted by jeremyjarrelljeremyjarrell(2685) 5 years, 2 months ago

Did you know that by using the Action delegate we can define a single operation which will automatically be applied to every member of an array? This is a great way to make your code cleaner and more elegant, read more...

add a comment |category: |Views: 37

tags: another

Managing collections with functors(dotnetslackers.com)

submitted by simonebsimoneb(5450) 5 years, 9 months ago

An easy way of working with collections using the new features of C# 2.0. read more...

1 comment |category: |Views: 8

tags: another