TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
diablosvo
NA
21
0
C# switch statment
Mar 16 2004 10:08 PM
I don't wish to tell you what my program is, since it would be pointless and the program is fairly short. So I will just show you my problem. I'm trying to compare a input by the user with a data filed with in an object. Here is the swtich statment. code:-------------------------------------------------------------------------------- string Icodon = Console.ReadLine(); for(int i=0;i < codons.Length;i++) { switch(Icodon) { case codons[i].codon1: Console.WriteLine(codons[i].codon1); break; default: Console.WriteLine("Default"); break; } } -------------------------------------------------------------------------------- here is the object, its defined: code:-------------------------------------------------------------------------------- codon methCodon = new codon("Methionine", "ATG", null, null, null,null, null); codon[] codons = new codon[1]; codons[0]=methCodon; -------------------------------------------------------------------------------- I also put it in an object array, can anyone tell me whats wrong? Here is the error when I compile it: code:-------------------------------------------------------------------------------- C:\Documents and Settings\***\My Documents\Visual Studio Projects\RNA\Class1.cs(56): A constant value is expected --------------------------------------------------------------------------------
Reply
Answers (
3
)
New to .Net Tecnology
List of Win32 APIs