views:

58

answers:

2

Hi, I am just wondering whether it is possible to have something like that, I mean to initialize object that I want to pass as an argument without writing it on special line:

String a="test";
a.TrimStart(new char [] X=['a'])
A: 
a.TrimStart(new char[] { 'a' });

You can even leave out the "char":

a.TrimStart(new[] { 'a' });
winSharp93
Or simply:a.TrimStart(new[] { 'a' });
David Morton
Just added the same :-)
winSharp93
Can't leave out the char in 2.0...
Jacob G
+1  A: 

yes you can, but you can't assign name to it. Try:

a.TrimStart(new char[] {'a'})
Andrey