Console.Write Method (Decimal)
.NET Framework (current version)
![]() |
---|
The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience. |
Writes the text representation of the specified Decimal value to the standard output stream.
Assembly: mscorlib (in mscorlib.dll)
[HostProtectionAttribute(SecurityAction.LinkDemand, UI = true)] public static void Write( decimal value )
Parameters
- value
-
Type:
System.Decimal
The value to write.
Exception | Condition |
---|---|
IOException | An I/O error occurred. |
The text representation of value is produced by calling Decimal.ToString.
The following example illustrates the use of the Write method.
public class FormatConverter { public static void Main(string[] args) { string lineInput; while ((lineInput = Console.ReadLine()) != null) { string[] fields = lineInput.Split(new char[] {'\t'}); bool isFirstField = true; foreach(string item in fields) { if (isFirstField) isFirstField = false; else Console.Write(','); // If the field represents a boolean, replace with a numeric representation. try { Console.Write(Convert.ToByte(Convert.ToBoolean(item))); } catch(FormatException) { Console.Write(item); } } Console.WriteLine(); } } }
UIPermission
for modifying safe top-level windows and subwindows. Associated enumeration: UIPermissionWindow.SafeTopLevelWindows
.NET Framework
Available since 1.1
Available since 1.1
Show: