Home  |  Delphi .net Home  |  System.Convert  |  ToByte Method
  
ToByte  
Method  
Converts data from one data type to a Byte data type
Convert Class
System NameSpace
CF1.  Function ToByte ( Value : Boolean ) : Byte; Static;
CF2.  Function ToByte ( Value : Cardinal ) : Byte; Static;
CF3.  Function ToByte ( Value : Byte ) : Byte; Static;
CF4.  Function ToByte ( Value : Char ) : Byte; Static;
CF5.  Function ToByte ( Value : SmallInt ) : Byte; Static;
CF6.  Function ToByte ( Value : ShortInt ) : Byte; Static;
CF7.  Function ToByte ( Value : Integer ) : Byte; Static;
CF8.  Function ToByte ( Value : Int64 ) : Byte; Static;
CF9.  Function ToByte ( Value : UInt64 ) : Byte; Static;
CF10.  Function ToByte ( Value : Word ) : Byte; Static;
CF11.  Function ToByte ( Value : Single ) : Byte; Static;
CF12.  Function ToByte ( Value : Double ) : Byte; Static;
CF13.  Function ToByte ( Value : Decimal ) : Byte; Static;
CF14.  Function ToByte ( Value : DateTime ) : Byte; Static;
CF15.  Function ToByte ( Value : String ) : Byte; Static;
CF16.  Function ToByte ( Value : String; FormatProvider : IFormatProvider ) : Byte; Static;
CF17.  Function ToByte ( Value : Object ) : Byte; Static;
CF18.  Function ToByte ( Value : Object; FormatProvider : IFormatProvider ) : Byte; Static;
CF : Methods with this mark are Compact Framework Compatible
Description
Attempts to transfer the value from one of the given Value data types to Byte.
 
The optional FormatProvider parameter determines the parsing rules and is beyond the scope of this article.
Notes
An exception is thrown if the conversion fails.
Microsoft MSDN Links
System
System.Convert
 Author links

 Buy Website Traffic at
 Buywebsitetrafficexperts.com

 Buy Proxies at
 Buyproxies.io
 
 
 
A simple example
program Project1;
{$APPTYPE CONSOLE}

var
  myByte : Byte;
  myStr  : String;

begin
  myStr  := '123';

  myByte := System.Convert.ToByte(myStr);

  Console.WriteLine(myByte.ToString);

  Console.ReadLine;
end.
   123
 
 
Delphi Programming Neil Moffatt 2002 - 2017. All rights reserved.  |  Contact the author