ExtensionMethod.NET Home of 880 C#, Visual Basic, F# and Javascript extension methods

Quick writeline

Write a variable to System.Diagnostics.Debug.WriteLine() (Or other output method)

Source

//Output with newline
public static void WriteLine(this object obj)
{
     System.Diagnostics.Debug.WriteLine(obj);
}

//Output without new line
public static void Write(this object obj)
{
     System.Diagnostics.Debug.Write(obj);
}

Example

var x = "Example1";
x.WriteLine();

"Example2".WriteLine();

"Example".Write();
3.WriteLine();



//Output
Example1
Example2
Example3

Author: Rob Leclerc

Submitted on: 19 mei 2009

Language: C#

Type: System.Object

Views: 4544