By tag: delegates
0
kicks
C# 101: Delegates and Lambdas
The purpose of this article is to demystify delegates and help you gain some understanding about how different ways of using delegates relate to each other.
0
kicks
Finding duplicate code in C#, VB.Net, ASPX, Ruby, Python, Java, C, C++
Whether you realize it or not, you need a tool that finds duplicate source code in your applications. In fact, if you’ve never used one before, you probably don’t realize just how much you need an automated solution to this problem. For all practical purposes, it’s nearly impossible to manually loc...
0
kicks
Using delegates to eliminate duplicate code
Here’s a simple technique you can use to easily eliminate duplicate code. Try not to let the word “delegates” scare you away from learning the technique and I’ll try to refrain from using the word “delegate” as much as possible. I’ll start small and then work my way towards a more complex example t...
0
kicks
C# Delegate Shortcut – No more null testing on events for subscribers
Do you use this syntax? It adds up as you can leave null tests in the dust for event subscribers:
EXAMPLE:
public event EventHandler<AnimationImageEventArgs> AnimationImageClicked = delegate { };
Post has full details, but most might already know this. If not your wasting cycles.
0
kicks
Understanding ASP.NET Ajax Callbacks, Delegates and DomEvents
Great article by Darren explaining some of the potential gotcha's with ASP.NET Ajax development for the uninitiated.
0
kicks
Extension methods and Curried Delegates
Since Extension methods behave like instance method it makes sense that we should be able to create delegates that would accept the instance method signature, to this end we have included Adding an Extension Methods to delegate invocation List
0
kicks
Command Pattern in C# 2.0 = Generics + delegates
How to implement Command Design pattern in C# 2.0 in a way that is more suitable with C# 2.0
0
kicks
Solving the Problem with Events: Weak Event Handlers
One of the greatest frustration of working with delegates and events is that they can potentially cause memory leaks if they aren't unhooked. In this article, we will solve this problem in a variety of ways to get the best performance, memory use and syntax.
0
kicks
Video: Creating Custom Events and Delegates with C#
It's no secret that events and delegates play a crucial role in the .NET framework. Without them it would be hard to handle user input or notify other objects when an action occurs. In this video Dan Wahlin outlines the fundamentals of creating a custom class that exposes an event and a delegate. ...
0
kicks
Concatenating Delimited Strings With Generic Delegates
Demonstrates the use of the Converter generic delegate to create a generic method to create a delimited string from a collection of objects.
0
kicks
C# Delegates and Events
Learn to use C# delegates and events. Excerpt: n programming, you are often faced with situations where you need to execute a particular action, but you don’t know in advance which method, or even which object, you’ll want to call upon to execute it. For example, a button might know that it must not...
0
kicks
C# Delegates and Events
Learn all about C# delegates and events. Excerpt: A delegate is a .NET class that encapsulates a method, but not in the same way other classes encapsulate methods. A delegate actually stores the address of a method that is contained in some other class. So, a delegate is really the equivalent of a f...