0

Hi how do i create a final variable string and send in one parameter to it

public static string POISON_PILL = new string("AAA");
when i do this it gives me an error highlighting the 'new string("AAA"); '

error msg: initalizes a new instance of the system.string class to the value indicated by an array of unicode characers.

does anyone have any idea ??

appreciate a reply
thanks

3
Contributors
4
Replies
6
Views
5 Years
Discussion Span
Last Post by Michael27
0

i get an error saying:

Error 1 The best overloaded method match for 'string.String(char[])' has some invalid arguments 11 44 PF

Error 2 Argument '1': cannot convert from 'string' to 'char[]' 11 55 PF

0

You don't need to explictly call a constructor for a string. Infact, there is not a constructor for String that takes a String as an argument. All you need to do is:

public static string POISON_PILL = "AAA";

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.