keyongtech


  keyongtech > dotnet.framework.* > dotnet.framework.compactframework > 03/2006

 #1  
03-16-06, 08:54 AM
MobileBoy36
Hello group,

What is the equivalent of this code snippet in C#?

public event EventHandler OnConnect
{
add { lock(syncRoot) { connectedEvent += value; } }
remove { lock(syncRoot) { connectedEvent -= value; } }
}

best regards,
Mobile Boy
 #2  
03-16-06, 09:39 AM
Daniel Moth
First you have to ask yourself if you *really* need custom events. 99% of
the time you don't.

If you really do, then VB2005 supports them so you are out of luck if you
are targeting CF v1.0.

For the syntax read this:
[url down]

Cheers
Daniel
 #3  
03-17-06, 12:50 PM
MobileBoy36
Thanks for your response Daniel...

Do you already now how to achieve the += in VB.NET on the line
connectedEvent += value?

best regards

"Daniel Moth" <dmoth74> schreef in bericht
news:4952
[..]
 #4  
03-17-06, 03:15 PM
Daniel Moth
Look at the site I referenced. It shows an example of that (hint: Combine
and Remove methods of your delegate). I am sure msdn2 has an example too but
here is yet another:
http://www.lhotka.net/WeBlog/BetterV...olution. aspx

Cheers
Daniel
Similar Threads
VBA or VB.net equivalent of Equivalent of WordBasic WordBasic.SelectCurWord

I have a old wordbasic code that I am converting to VSTO what is equivalent of Word 97 (WordBasic) code WordBasic.SelectCurWord in VSTO Tried several...

Equivalent of GetPrivateProfileString equivalent in C#?

Does C# has an equivalent of the 'C' GetPrivateProfileString? or is the only way to get similar features to read from an INI file is to do a DllImport on Kernel32.dll? Thanks

a[i] not equivalent to *(a+i)?

Hello, I have a question regarding old good array and pointers. I remember reading a remark by Bjarne Stroustrup that a[i] is not equivalent to *(a+i) when it comes to...

MRU equivalent in .NET

Is there an equivalent implementation of CRecentFileList (MFC) in the .NET framework, or a sample of how to do this efficiently. Right now I am just using an array of...

Are these equivalent?

Are the following two statements equivalent? bitField = (bitField & (--bitField)); bitField = (bitField & (bitField-1)); Yes or no?


All times are GMT. The time now is 08:46 PM. | Privacy Policy