C # String.Join

Source: Internet
Author: User

String.Join method

The String.Join () method is often used in common work, and there are nine (overloaded) methods in the runtime (System.Runtime, version=4.2.0.0) used with vs 2017.

//        //Summary://concatenates the members of a collection, using the specified separator between//Each member. //        //Parameters://Separator://The string to use as a separator.separator are included in the returned string//The only if values have more than one element. //        //values://A collection that contains the objects to concatenate. //        //type parameter://T://The type of the members of the values. //        //return Result://A String that consists of values delimited by the separator string. //If values have no members, the method returns System.String.Empty. //        //Exception://T:System.ArgumentNullException://values is null.         Public StaticString join<t> (String separator, ienumerable<t>values); //        //Summary://Concatenates the members of a constructed System.Collections.Generic.IEnumerable ' 1//collection of type System.String, using the specified separator between each//member. //        //Parameters://Separator://The string to use as a separator.separator are included in the returned string//The only if values have more than one element. //        //values://A collection that contains the strings to concatenate. //        //return Result://A String that consists of values delimited by the separator string. //If values have no members, the method returns System.String.Empty. //        //Exception://T:System.ArgumentNullException://values is null.         Public StaticString Join (String separator, ienumerable<string>values); //        //Summary://concatenates the elements of an object array, using the specified separator between//Each element. //        //Parameters://Separator://The string to use as a separator. Separator are included in the returned string//The only if values have more than one element. //        //values://An array, the contains the elements to concatenate. //        //return Result://A String that consists of the elements of values delimited by the separator string. //If values are an empty array, the method returns System.String.Empty. //        //Exception://T:System.ArgumentNullException://values is null.         Public StaticString Join (String separator,params Object[] values); //        //Summary://concatenates all the elements of a string array, using the specified separator//between each element. //        //Parameters://Separator://The string to use as a separator. Separator are included in the returned string//Only if the value has a more than one element. //        //Value://An array, the contains the elements to concatenate. //        //return Result://A String that consists of the elements in value delimited by the separator string. //If value is an empty array, the method returns System.String.Empty. //        //Exception://T:System.ArgumentNullException://value is null.         Public StaticString Join (String separator,paramsstring[] value); //        //Summary://concatenates the specified elements of a string array, using the specified separator//between each element. //        //Parameters://Separator://The string to use as a separator. Separator are included in the returned string//Only if the value has a more than one element. //        //Value://An array, the contains the elements to concatenate. //        //StartIndex://The first element in value to use . //        //Count://The number of elements of value to use . //        //return Result://A String that consists of the strings in value delimited by the separator string. //-or-system.string.empty If Count is zero, and value has no elements, or separator//And all the elements of value is System.String.Empty. //        //Exception://T:System.ArgumentNullException://value is null. //        //T:System.ArgumentOutOfRangeException://StartIndex or count is less than 0.-or-startindex plus count is greater than//The number of elements in value. //        //T:System.OutOfMemoryException://Out of memory.         Public StaticString Join (String separator, string[] value,intStartIndex,intcount); //        //Parameters://Separator://        //Value:         Public StaticString Join (CharSeparatorparamsstring[] value); //        //Parameters://Separator://        //Value://        //StartIndex://        //Count:         Public StaticString Join (CharSeparator, string[] value,intStartIndex,intcount); //        //Parameters://Separator://        //values:         Public StaticString Join (CharSeparatorparams Object[] values); //        //Parameters://Separator://        //values://        //type parameter://T:         Public StaticString join<t> (CharSeparator, ienumerable<t> values);
string. Description of Join overloading method

So the usual way of writing, basically covered.

Common methods: Separator "," for example.

String. Join (', ', string[])//character ', ' Split, splice string array

String. Join (', ',list<string>)//character ', ' Split, stitch string list

String. Join (",", string[])//String "," split, splice character array

String. Join (",",list<string>)//String "," split, splice character array

Note: There are not so many overloaded methods in vs2013, so be careful.

C # String.Join

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.