public void alert( object s ) {
MessageBox.Show( s.ToString() ); // Explicit conversion here
}
Note: compiled, strongly-typed language like C# and VB beat runtime speed of loosely-typed and/or interpreted languages like JavaScript. Use constructs like Object (or var) sparingly!
MessageBox.Show( string1 , string2 , myNumber.ToString() ); // Perfectly valid!
But let's revise our code to accept an array instead to get more control over output formatting.public void alert( params string[] args ) {
MessageBox.Show( "|" + args.Join("|\n|") + "|" );
}