473,796 Members | 2,679 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

'is' operator is giving compile error when used with switch statem

Raj
public static void HandleException (ref Exception io_exException,
bool
i_blnPropagateE xception)
{
switch (true)
{
case io_exException is ApplicationHand ledException:
{
if (i_blnPropagate Exception)
{
throw io_exException;
}
break;
}
case io_exException is ApplicationBusi nessException:
{
if (i_blnPropagate Exception)
{
throw io_exException;
}
break;
}
}
}

This function is not compiling coming with error "A constant value is
required". In the function 'ApplicationHan dledException' and
'ApplicationBus inessException' are classes inherited from
System.Applicat ionException.

Can someone please help me what is the reason and what is the way around? If
this is not possible what can be the alternative way?

May 11 '06 #1
1 970
"Raj" <ra*******@logi cacmg.com> wrote in message
news:9F******** *************** ***********@mic rosoft.com...
public static void HandleException (ref Exception io_exException,
bool
i_blnPropagateE xception)
{
switch (true)
{
case io_exException is ApplicationHand ledException:
{
if (i_blnPropagate Exception)
{
throw io_exException;
}
break;
}
case io_exException is ApplicationBusi nessException:
{
if (i_blnPropagate Exception)
{
throw io_exException;
}
break;
}
}
}

This function is not compiling coming with error "A constant value is
required". In the function 'ApplicationHan dledException' and
'ApplicationBus inessException' are classes inherited from
System.Applicat ionException.

Can someone please help me what is the reason and what is the way around?
If
this is not possible what can be the alternative way?


Please post this in the C# newsgroup, this is a C++/CLI newgroup
May 11 '06 #2

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

Similar topics

193
9653
by: Michael B. | last post by:
I was just thinking about this, specifically wondering if there's any features that the C specification currently lacks, and which may be included in some future standardization. Of course, I speak only of features in the spirit of C; something like object-orientation, though a nice feature, does not belong in C. Something like being able to #define a #define would be very handy, though, e.g: #define DECLARE_FOO(bar) #define...
17
3502
by: Anoob | last post by:
Can we consider () unary operator when calling a function, in exps eq. f(), ( 1 + 2). But when we call function f( 10 ) it is a binary operator. Even if we pass f( 10, 20) as we are using , operator there one operand will be there for ()? And Unary operators like !, +, -, ~, ... are said to be having associativity right to left which means that we can write, (but not allowed) 1. 2! 2. !2
134
8049
by: evolnet.regular | last post by:
I've been utilising C for lots of small and a few medium-sized personal projects over the course of the past decade, and I've realised lately just how little progress it's made since then. I've increasingly been using scripting languages (especially Python and Bourne shell) which offer the same speed and yet are far more simple and safe to use. I can no longer understand why anyone would willingly use C to program anything but the lowest...
9
1611
by: Raj | last post by:
public static void HandleException(ref Exception io_exException, bool i_blnPropagateException) { switch (true) { case io_exException is ApplicationHandledException: { if (i_blnPropagateException) {
0
9685
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
9535
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
10242
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...
1
10200
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6800
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5453
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...
0
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4127
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
3744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.