Hello,
I have an enum that uses the # sign in a Constant and I'm getting
syntax errors. How do I excape this in my code.
enum Notes
{
A,
A#,
B,
C,
C#,
D,
D#,
E,
F,
F#,
G,
G#
}
Thanks
Mike 5 1360
Mike,
The compiler will not allow this, since the identifer is invalid. You
will need to use ASharp, CSharp, etc, etc. Personally, I think that this is
more readable.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Mike" <am******@gmail .com> wrote in message
news:11******** **************@ g43g2000cwa.goo glegroups.com.. . Hello, I have an enum that uses the # sign in a Constant and I'm getting syntax errors. How do I excape this in my code. enum Notes { A, A#, B, C, C#, D, D#, E, F, F#, G, G# } Thanks Mike
Enums must follow the same constraints that any variable or symbols follow.
If you cannot make a variable with that name then you cannot make an enum
value with that name.
"Mike" <am******@gmail .com> wrote in message
news:11******** **************@ g43g2000cwa.goo glegroups.com.. . Hello, I have an enum that uses the # sign in a Constant and I'm getting syntax errors. How do I excape this in my code. enum Notes { A, A#, B, C, C#, D, D#, E, F, F#, G, G# } Thanks Mike
enum Notes
{
A,
Asharp,
B,
C,
Csharp,
D,
Dsharp,
E,
F,
Fsharp,
G,
Gsharp
}
Like everyone else said, you can't use '#' as an enum value ...but
since you're doing something related to music, you can also do this ...
enum Notes
{
A
Bb
B
C
Db
D
Eb
E
F
Gb
G
Ab
}
Granted, I hate seeing Gb instead of F# in music scores, it does get
the point across :)
Clint
Mike wrote: Hello, I have an enum that uses the # sign in a Constant and I'm getting syntax errors. How do I excape this in my code. enum Notes { A, A#, B, C, C#, D, D#, E, F, F#, G, G# } Thanks Mike
Thanks All
I think the ASharp syntax should work.And Clint, I feel the same way.
Mike This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: rwalker |
last post by:
Error number 429 - COM object with CLSID
{000209F0-0000-0000-C000-000000000046} is either not valid or not
registered.
Intermittent occurance of this error. Using Word.Global to run word
macro in vb .net application.
CODE:
Friend WordGlobal_definst As Object
|
by: cooldv |
last post by:
i know how to replace the sign " when SUBMITTING a form in asp by this
code:
message = Replace(usermessage, "'", "''").
My problem is DISPLAYING data in an asp FORM, from an an access
database, when the data already contains a " sign
problem is like this:
access database .... to update on the internet .... a *dataupdate.asp*
page ..... On this page, the data gets displayed in a form where i
|
by: Don Clark |
last post by:
Hello;
Admittedly, I'm very new to HTML, and this is my first post to any
newsgroup, so please go easy. I was looking at the html code for an email I
received and noted an href statement that looked very unusual. The statement
was:
<a href=3D"http://www.%76%69t%2D%63%6F.com">
<INPUT TYPE=3D"submit" VALUE=3D"Order Here" style=3D"font-family: Verdana;
color: #3F79C0; ">
|
by: tarmat |
last post by:
sorry for this silly little question, but whats the function to grab
the sign of a value?
|
by: thx606 |
last post by:
Hello,
I'm having problems figuring this one out. I have 2 combo boxes. The
first one the user selects a professor then the second one they select
a course and that works fine. Here is my problem for a third field used
for mailing instructions. I would like to look this up in a seperate
table based off the values entered in the combo boxes. So, if
professor and Course match then that mailing instructon would appear in
the third field....
| |
by: Kun |
last post by:
i have an html/cgi input that takes in values to a mysql database,
however, if i stick in $20 instead of 20, it crashes the program because
of the extra $ sign. I was wondering if anyone has a quick regular
expression in python to remove the $-sign if it is present in the input.
|
by: ericms |
last post by:
Can anybody show me how to insert a CDATA section using XPathNavigator ? I
have tried the follwing with no luck:
XmlDocument docNav = new XmlDocument();
docNav.LoadXml(xmlString);
XPathNavigator nav = docNav.CreateNavigator();
XmlDocument doc = new XmlDocument();
doc.LoadXml("<DocumentData></DocumentData>");
XmlElement elem = doc.CreateElement(currentNodeName);
|
by: Peter Ravnholt |
last post by:
Hello all,
It seems that digitally signing XML documents using the SignedXml class has
a bug - or at least a behavior I cannot explain.
The problem occurs when I sign XML documents containing namespace prefixes
and namespace references and then validate it. The validation always fails
(returns false) in this case. When I remove the namespace prefixes and
namespace references from the XML, signing and validating works fine.
|
by: thomas.mertes |
last post by:
Generally C is well suited as target language for compilers.
I use C as target language for the Seed7 compiler. This
works good. There are just some things where the
behaviour of C is undefined:
The right shift operator (>>) of C may or may not sign
extend for signed negative numbers.
Since the right shift operation of Seed7 is defined as sign
extending shift, I have to check if the C compiler does
|
by: Ravikiran |
last post by:
Hi Friends,
I wanted know about whatt is ment by zero optimization and
sign optimization and its differences....
Thank you...
|
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,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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...
|
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,...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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...
|
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...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |