Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
86 views
in Technique[技术] by (71.8m points)

c# - What's the difference between {"::"} and "::"?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The code line string[] separator = {"::"}; is initializing array separator. This syntax to initialize the array is referred as Implicitly Typed Arrays.

Currently your code using Split(String[], StringSplitOptions) method of string to split the string where the first arg is type of string array. If you have only one seperator (i.e. ::) then you can use the overload method Split(String, StringSplitOptions) by below code

 string separator = "::";
 var seperatedCardString = currentCard.Name.Split(
    separator, StringSplitOptions.RemoveEmptyEntries);

Check all the overload of string Split method at here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...