Solved

C# array

Posted on 2007-03-17
2
173 Views
Last Modified: 2013-12-17
Please advise how to fix the below array assignment in C# :

    public string[] Roles = new string["Catcher",
        "Pitcher", "First Base", "Second Base", "Third Base",
        "Short Stop", "Left Field", "Center Field", "Right Field"];
0
Comment
Question by:ksfok
2 Comments
 
LVL 62

Accepted Solution

by:
Fernando Soto earned 350 total points
Comment Utility
Hi ksfok;

Here you go.

        public string[] Roles = {"Catcher",
                "Pitcher", "First Base", "Second Base", "Third Base",
                "Short Stop", "Left Field", "Center Field", "Right Field"};

Fernando
0
 
LVL 29

Assisted Solution

by:Gautham Janardhan
Gautham Janardhan earned 150 total points
Comment Utility
or u can assign

like
 public string[] Roles = new string [9];
and then assign values

Roles[0] = "Catcher"; and so on
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now