Home  |  Delphi .net Home  |  System.Enum  |  ToObject Method
  
ToObject  
Method  
Creates an Enum object of the specified type and value
Enum Class
System NameSpace
CF1.  Function ToObject ( EnumeratedType : Type; Value : Object ) : Object; Static;
NotCF2.  Function ToObject ( EnumeratedType : Type; Value : Byte ) : Object; Static;
NotCF3.  Function ToObject ( EnumeratedType : Type; Value : SmallInt ) : Object; Static;
NotCF4.  Function ToObject ( EnumeratedType : Type; Value : ShortInt ) : Object; Static;
NotCF5.  Function ToObject ( EnumeratedType : Type; Value : Integer ) : Object; Static;
NotCF6.  Function ToObject ( EnumeratedType : Type; Value : Word ) : Object; Static;
NotCF7.  Function ToObject ( EnumeratedType : Type; Value : Int64 ) : Object; Static;
NotCF8.  Function ToObject ( EnumeratedType : Type; Value : UInt64 ) : Object; Static;
NotCF9.  Function ToObject ( EnumeratedType : Type; Value : Cardinal ) : Object; Static;
CF : Methods with this mark are Compact Framework Compatible
Description
A new enumerated object is created of the specified EnumeratedType, set to Value. The value is interprated as the numeric value of an enum entry for this enum type.
Microsoft MSDN Links
System
System.Enum
 Author links

 Buy Website Traffic at
 Buywebsitetrafficexperts.com

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

var
  day : System.Object;

begin
  // Create a DayOfWeek object set to Thursday (=4)
  day := System.Enum.ToObject(TypeOf(System.DayOfWeek), 4);

  Console.WriteLine(day.ToString);

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