473,396 Members | 1,784 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

new EventHandler(delegate {})

private void SerialPortLog(LogMsgType msgtype, string msg)
{

{
txtReadData.Invoke(new EventHandler(delegate
{
txtReadData.SelectedText = string.Empty;
txtReadData.SelectionFont = new
Font(txtReadData.SelectionFont, FontStyle.Bold);
txtReadData.SelectionColor =
LogMsgTypeColor[(int)msgtype];
txtReadData.AppendText(msg);
txtReadData.ScrollToCaret();
}));

}
In the context of this method, can someone explain to me how to parse
this:

txtReadData.Invoke(new EventHandler(delegate {}

Is this something new in 2008? part of an anonymous method?

By parse, I mean. explain what is happening here between the event
handler & the delegate. Declarations of both are left out.

Thanks, Tom
Aug 5 '08 #1
1 7620
Blip wrote:
>
In the context of this method, can someone explain to me how to parse
this:

txtReadData.Invoke(new EventHandler(delegate {}

Is this something new in 2008? part of an anonymous method?
That is new in C# 2005, not in 2008. The delegate {} part defines an
anonymous method.
See http://msdn.microsoft.com/en-us/libr...5k(VS.80).aspx
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Aug 5 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Sandor Heese | last post by:
Question, When using BeginInvoke (on a From to marshal to the UI thread) with the EventHandler delegate I see some strange behaviour. The problem is that I call the UpdateTextBox method with a...
5
by: Torben | last post by:
For test purposes I attach an event to a control, say a TextBox TextChanged event. At another time the same event delegate is attached to some other control, maybe a listbox. Same event function...
9
by: Christopher Weaver | last post by:
Can anyone tell me how I could iterate through a collection of controls on a form while assigning their event handlers to another identical collection of controls on the same form. So far,...
13
by: jac | last post by:
Hae, I have a windows form with a ComboBox an other things. On that combobox I have an eventhandler on de selectedindexchanged. But somewhere in my code want to do excecute the same code that...
3
by: Minh Khoa | last post by:
Please give me more information about delegate and its usage? Why do i use it and when?
2
by: zamir.khan | last post by:
Hello all, New to the groups, sorry if this the wrong forum/etiquette. I am coding a c++ application that requires the use of a timer-triggered event handler. I decided to use the timer provided...
7
by: Ant | last post by:
Hello, Very simple question but one I need clarified. Which part of the statement below is considered the 'delegate'? Is it the 'new System.EventHandler' or the btnAccept_Click? or is it...
6
by: David Veeneman | last post by:
I have several events that pass a value in their event args. One event passes an int, another a string, another a DateTime, and so on. Rather than creating a separate set of event args for each...
2
by: markliam | last post by:
I have auto-generated some code for a button by double clicking it. By default, the code is created with a return type of void and assigned to a click event. Now, I want the function to return a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.