The Pragmatic Programmer

Tulisan iseng kalo ada waktu.
See also: Other Geeks@INDC

Just a simple question

 Without using your compiler, guess what will be the output of this code:

        static void Main(string[] args)
        {
            string s = "A";
            s = string.Concat(s, "B");
            s = string.Join(s, new string[] { "1", "2", "3" });

            Console.WriteLine(s);

            Console.ReadLine();
        }

and why?

Share this post: | | | |

Comments

hakimrie said:

/*

kayaknya outputnya kayak gini:

1AB2AB3

soale kalo gak salah kan ngene definisine:

string.Join(separator,value);

jadi method join itu menggabung dari tiap satuan string pada array of string value dengan separator.

jadi, jika separator = s = "AB"

value = "1", "2", "3"

ya ketika di join ya jadinya begitu (1AB2AB3), gitu gak?

nuhun

*/

# April 5, 2008 7:56 PM
Leave a Comment

(required) 

(required) 

(optional)

(required) 
Are you human?:  


Enter the numbers above: