473,770 Members | 1,523 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to test if a delegate or event is empty

In C# is very easy:

if(myDelegate== null)
//Install it.

but in C++/CLI that does not work:

if(myDelegate== nullptr)
//Install it.

gives:

Error C3918:usage requires 'member' to be a data member

But myDelegate has operator == overloaded. I don't understand why it fails.
If I try some like this:

myDelegate->GetInvocationL ist()->Length==0

I get same error.

And other variations.
--
Visita mi blog: http://rfog.blogsome.com
Libros, ciencia ficción y programación
=============== =============== ==========
La amistad es más difícil y más rara que el amor. Por eso, hay que salvarla
como sea.
-- Alberto Moravia. (1907-1990) Escritor italiano.
Oct 13 '06 #1
1 5698

"RFOG" <ze************ @QUITAME.gmail. comwrote in message
news:uz******** ******@TK2MSFTN GP02.phx.gbl...
In C# is very easy:

if(myDelegate== null)
//Install it.

but in C++/CLI that does not work:

if(myDelegate== nullptr)
//Install it.

gives:

Error C3918:usage requires 'member' to be a data member
Use a custom event, like this:

private:

//! \brief MulticastDelega te chain of event handlers for the \ref Closed
event.

System::EventHa ndler^ CloseHandlers;

public:

virtual event System::EventHa ndler^ Closed

{

void add( System::EventHa ndler^ handler )

{

CloseHandlers += handler;

}

void remove( System::EventHa ndler^ handler )

{

CloseHandlers += handler;

}

}

>
But myDelegate has operator == overloaded. I don't understand why it
fails.
If I try some like this:

myDelegate->GetInvocationL ist()->Length==0

I get same error.

And other variations.
--
Visita mi blog: http://rfog.blogsome.com
Libros, ciencia ficción y programación
=============== =============== ==========
La amistad es más difícil y más rara que el amor. Por eso, hay que
salvarla como sea.
-- Alberto Moravia. (1907-1990) Escritor italiano.


Nov 7 '06 #2

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

Similar topics

0
2314
by: Tim Haughton | last post by:
I've just released an article on using Test Driven Development with C# and Windows Forms. GUI's are often difficult to test, so I thought it might be of interest. The article along with the example source code can be downloaded here: http://www.blogitek.com/timhaughton/archives/files/User%20Interrogator%20And%20TDD.zip The article text is below. Not sure what it will do to the formatting when
1
1690
by: Michael A. Covington | last post by:
Is there a simple way to empty out the Paint delegate (which is a list of method calls) before adding something to it? I'm envision a large, casually designed, experimental program in which various menu choices will each put a different routine into OnPaint, and each of them would want to clear out the previously added ones first, without necessarily knowing what they are. I can't use assignment (=) with this.Paint, but I can use +=...
3
2618
by: Minh Khoa | last post by:
Please give me more information about delegate and its usage? Why do i use it and when?
7
1778
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 the piece of code which doesn't appear here, but abstracts the btnAccept_Click method?
2
3431
by: =?Utf-8?B?QXJtaW4gR2FsbGlrZXI=?= | last post by:
Hi I've got an unexpected error in a unit test. I want to test a activity from Windows Workflow Foundation (WF). First, I executed the test outside of the activity just in the test-init method. In this case all works fine: public void TestInitialize() {
7
2725
by: Stefan Hoffmann | last post by:
hi @all, is there something like an anonymous delegate? This is the original code: -- private delegate void DelegateSetFormCaption(string text); private void SetFormCaption(string text) {
0
2941
by: CMELLO | last post by:
I have am dynamically loading a web user control based on the click of a tab strip I load the default control for the first tab in the page load event after checking page is not postback. After that the controls are loaded/unloaded based on the SelectionChanged event for the tab strip and again in Page load because with a dynamic load viewstate has to be reloaded. I have a datalist in the user control and I am trying to create the...
0
1915
by: =?Utf-8?B?Y2luZHk=?= | last post by:
I have am dynamically loading a web user control based on the click of a tab strip I load the default control for the first tab in the page load event after checking page is not postback. After that the controls are loaded/unloaded based on the SelectionChanged event for the tab strip and again in Page load because with a dynamic load viewstate has to be reloaded. I have a datalist in the user control and I am trying to create the...
2
10045
by: hcaptech | last post by:
This is my Test.can you help me ? 1.Which of the following statement about C# varialble is incorrect ? A.A variable is a computer memory location identified by a unique name B.A variable's name is used to access and read the value stored in it C.A variable is allocated or deallocated in memory during runtime D.A variable can be initialized at the time of its creation or later 2. The.……types feature facilitates the definition of classes...
0
9592
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9425
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10058
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9870
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7416
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5313
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3972
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3576
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2817
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.