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 1337
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.com
"Mike" <am******@gmail.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.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.googlegr oups.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...
|
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,...
|
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...
|
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...
|
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...
|
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);...
|
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...
|
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:
...
|
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: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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
|
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...
|
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...
|
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...
|
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...
|
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,...
|
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...
| |