Stories recently tagged with 'Delegates'

Finding duplicate code in C#, VB.Net, ASPX, Ruby, Python, Java, C, C++(alexdresko.com)

submitted by alexdreskoalexdresko(25) 1 year, 8 months ago

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 locate the types of duplicate code that such a tool can easily bring to the surface. Even if you think you’re intimately aware of an application’s code base, every line of code you write contains the potential to awaken the duplicate code dragon. read more...

add a comment |category: |Views: 5

tags: another

Using delegates to eliminate duplicate code(alexdresko.com)

submitted by alexdreskoalexdresko(25) 1 year, 9 months ago

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 that really demonstrates its power. read more...

add a comment |category: |Views: 37

tags: another

C# Delegate Shortcut – No more null testing on events for subscribers (blog.domaindotnet.com)

submitted by dcarrdcarr(790) 3 years, 6 months ago

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. read more...

add a comment |category: |Views: 93

tags: another

Understanding ASP.NET Ajax Callbacks, Delegates and DomEvents(showusyourcode.spaces.live.com)

submitted by jburgerjburger(815) 4 years, 6 months ago

Great article by Darren explaining some of the potential gotcha's with ASP.NET Ajax development for the uninitiated. read more...

add a comment |category: |Views: 28

tags: another

Extension methods and Curried Delegates(blogs.msdn.com)

submitted by CharlieCalvertCharlieCalvert(7875) 5 years ago

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 read more...

add a comment |category: |Views: 32

tags: another

Command Pattern in C# 2.0 = Generics + delegates(spellcoder.com)

submitted by bashmohandesbashmohandes(3000) 5 years, 2 months ago

How to implement Command Design pattern in C# 2.0 in a way that is more suitable with C# 2.0 read more...

1 comment |category: |Views: 2242

tags: another

Solving the Problem with Events: Weak Event Handlers(diditwith.net)

submitted by cls2degcls2deg(1535) 5 years, 2 months ago

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. read more...

2 comments |category: |Views: 480

tags: another

Video: Creating Custom Events and Delegates with C#(weblogs.asp.net)

submitted by dwahlindwahlin(1450) 5 years, 4 months ago

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. The video also demonstrates how to create a custom EventArgs class and how events can be consumed using C#. read more...

add a comment |category: |Views: 547

tags: another

C# Delegates(blogs.msdn.com)

submitted by CharlieCalvertCharlieCalvert(7875) 5 years, 4 months ago

This post provides introductory information on using delegates. read more...

add a comment |category: |Views: 13

tags: another

C# Delegates and Events (en.csharp-online.net)

submitted by HyleHyle(2755) 5 years, 5 months ago

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 notify some object when it is pushed, but it might not know which object or objects need to be notified. Instead of wiring the button to a particular object, you will connect the button to a delegate and then resolve that delegate to a particular method when the program executes. In the early, dark, and primitive days of computing, a program would begin execution and then proceed through its steps until it completed. If the user was involved, the interaction was strictly controlled and limited to filling in fields. Today’s GUI programming model requires a different approach, known as event driven programming. A modern program presents the user interface and waits for the user to take an action. The user might take many different actions, such as choosing among menu selections, pushing buttons, updating text fields, clicking icons, and so forth. Each action causes an event to be raised. Other events can be raised without direct user action, such as events that correspond to timer ticks of the internal clock, email being received, file-copy operations completing, etc. An event is the encapsulation of the idea that "something happened" to which the program must respond. Events and delegates are tightly coupled concepts because flexible event handling requires that the response to the event be dispatched to the appropriate event handler. An event handler is typically implemented in C# via a delegate. Delegates are also used as callbacks so that one class can say to another "do this work and when you’re done, let me know." read more...

add a comment |category: |Views: 24

tags: another

Concatenating Delimited Strings With Generic Delegates(haacked.com)

submitted by HaackedHaacked(5105) 5 years, 6 months ago

Demonstrates the use of the Converter generic delegate to create a generic method to create a delimited string from a collection of objects. read more...

add a comment |category: |Views: 9

tags: another

C# Delegates and Events(en.csharp-online.net)

submitted by HyleHyle(2755) 5 years, 6 months ago

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 function pointer in C++. However, they are also far more than that. In this article, I explain the many uses of delegates. I begin with a simple example using a delegate to invoke a method. Then, I show several other uses of delegates including multicast delegates, thread delegates, anonymous methods, asynchronous method calls, events, and Win32 callbacks. read more...

add a comment |category: |Views: 58

tags: another