E
Epson Barnett
I'm working on learning .NET and I'm curious about the reason for
using static methods in some cases. Specifically, the string class has
a split and a join method, but only the join method is static.
Both methods return a new string which is based on another string. It
would seem that both should not be static.
string mystring = "one, two, three, four";
string[] newstring = mystring.Split(',');
why not:
string[] mystring = new string[] {"one", "two", "three", "four"};
string newstring = mystring.Join(',');
I'd like to understand the underlying reason.
Thanks,
Epson
using static methods in some cases. Specifically, the string class has
a split and a join method, but only the join method is static.
Both methods return a new string which is based on another string. It
would seem that both should not be static.
string mystring = "one, two, three, four";
string[] newstring = mystring.Split(',');
why not:
string[] mystring = new string[] {"one", "two", "three", "four"};
string newstring = mystring.Join(',');
I'd like to understand the underlying reason.
Thanks,
Epson