Error!
Success!

By tag: Delegate

showing:  of
0
kicks

Using Async Delegates instead of the Thread class  (Unpublished)

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.


Kicked By:
Drop Kicked By:
0
kicks

When would you use delegates in C#?  (Unpublished)

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 nece...


Kicked By:
Drop Kicked By:
0
kicks

Creating a StreamProxy with Delegate/Lambda to read/write to a file  (Unpublished)

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.


Kicked By:
Drop Kicked By:
0
kicks

Get Your Func On  (Unpublished)

Using Func<T> and delegates for code decoupling.


Kicked By:
Drop Kicked By:
0
kicks

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

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


Kicked By:
Drop Kicked By:
0
kicks

C#: Care about Event Memory Leaks with Delegate.GetInvocationList()  (Unpublished)

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 st...


Kicked By:
Drop Kicked By:
0
kicks

Pluck Me!  (Unpublished)

Fun with Generics and Arrays and Delegates


Kicked By:
Drop Kicked By:
0
kicks

The Power of the Predicate<T>  (Unpublished)

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.


Kicked By:
Drop Kicked By:
0
kicks

The Action Delegate  (Unpublished)

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,


Kicked By:
Drop Kicked By:
0
kicks

Managing collections with functors  (Unpublished)

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


Kicked By:
Drop Kicked By: