Windows Phone @ MoDaCo: c sharp string array - Windows Phone @ MoDaCo

Jump to content

Galaxy Nexus Review
We put the Galaxy Nexus and Ice Cream Sandwich through their paces.

Google Music Launch
Google bring Music out of beta and launch their music store.

MoDaCo Plus / Ad Free
Hate ads? Want cool stuff? Sign up for a MoDaCo Plus / MoDaCo Ad Free account with Online Kitchen access!

Close
Open
Close
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

c sharp string array
-----


#1 User is offline   xarzu 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 5
  • Joined: 13-January 09

Posted 14 January 2009 - 05:09 AM

In a main routine of a c sharp program, you have a string array like this:
public static int Main(string[] arguments)

Well, let's suppose I am mimicing this sort of function. Would this be the proper use of a string array?
string
[] arguments;

arguments[0] =
"C:\\Users\\All Users\\Apple\\Some File.msi";

arguments[1] =
"C:\\Users\\All Users\\Apple\\Another FIle.msi";

I get a compile error
Compiler Error CS0165 right on the first line.

I guess this is not how to assign strings in C#. But I thought it was.


This post has been edited by xarzu: 14 January 2009 - 05:16 AM

0

Sponsored Links


#2 User is offline   DaveShaw 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 19
  • Joined: 21-November 08
  • Location:Huddersfield
  • Devices:HTC Kaiser

Posted 16 January 2009 - 10:22 AM

View Postxarzu, on Jan 14 2009, 05:09, said:

In a main routine of a c sharp program, you have a string array like this:
public static int Main(string[] arguments)

Well, let's suppose I am mimicing this sort of function. Would this be the proper use of a string array?
string
[] arguments;

arguments[0] =
"C:\\Users\\All Users\\Apple\\Some File.msi";

arguments[1] =
"C:\\Users\\All Users\\Apple\\Another FIle.msi";

I get a compile error
Compiler Error CS0165 right on the first line.

I guess this is not how to assign strings in C#. But I thought it was.



string[] arguments; //declares the array, you need to initialise it before you can use it.

string[] arguments= new string[2]; //declares the array and initialises it to 2 items.

Now you can do arguments[0] and arguments[1].

Also, check out: http://msdn.microsof...453(VS.71).aspx

Ta
Dave

This post has been edited by DaveShaw: 16 January 2009 - 10:22 AM

0


#3 User is offline   annliu 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 2
  • Joined: 11-February 09

Posted 11 February 2009 - 11:35 AM

Hi,there are many computer ebooks free download.

free ebook download

0


Sponsored Links

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users

MoDaCo is part of the MoDaCo.network, © Paul O'Brien 2002-2012. MoDaCo uses IntelliTxt technology. Privacy Policy / Contact Details.

Skin and Language

Sign in here


Sign in options
Log in with Facebook Log in with Twitter   Go to advanced login Register Now!