UInt64.GetTypeCode() Method in C# with Examples

CsharpServer Side ProgrammingProgramming

<p>The UInt64.GetTypeCode() method in C# is used to return the TypeCode for value type UInt64.</p><h2>Syntax</h2><p>Following is the syntax &minus;</p><pre class="result notranslate">public TypeCode GetTypeCode ();</pre><h2>Example</h2><p>Let us now see an example to implement the UInt64.GetTypeCode() method &minus;</p><!--<p><a href="" target="_blank" rel="nofollow" class="demo"><i class="fa-external-link"></i> Live Demo</a></p>--><pre class="prettyprint notranslate">using System; public class Demo { &nbsp; &nbsp;public static void Main(){ &nbsp; &nbsp; &nbsp; ulong val1 = 55; &nbsp; &nbsp; &nbsp; ulong val2 = 100; &nbsp; &nbsp; &nbsp; TypeCode type1 = val1.GetTypeCode(); &nbsp; &nbsp; &nbsp; TypeCode type2 = val2.GetTypeCode(); &nbsp; &nbsp; &nbsp; Console.WriteLine(&quot;Typecode for val1 = &quot;+type1); &nbsp; &nbsp; &nbsp; Console.WriteLine(&quot;Typecode for val2 = &quot;+type2); &nbsp; &nbsp;} }</pre><h2>Output</h2><p>This will produce the following output &minus;</p><pre class="result notranslate">Typecode for val1 = UInt64 Typecode for val2 = UInt64</pre><h2>Example</h2><p>Let us now see another example to implement the UInt32.GetTypeCode() method &minus;</p><!--<p><a href="" target="_blank" rel="nofollow" class="demo"><i class="fa-external-link"></i> Live Demo</a></p>--><pre class="prettyprint notranslate">using System; public class Demo { &nbsp; &nbsp;public static void Main(){ &nbsp; &nbsp; &nbsp; uint val1 = UInt64.MinValue; &nbsp; &nbsp; &nbsp; uint val2 = 0; &nbsp; &nbsp; &nbsp; TypeCode type1 = val1.GetTypeCode(); &nbsp; &nbsp; &nbsp; TypeCode type2 = val2.GetTypeCode(); &nbsp; &nbsp; &nbsp; Console.WriteLine(&quot;Typecode for val1 = &quot;+type1); &nbsp; &nbsp; &nbsp; Console.WriteLine(&quot;Typecode for val2 = &quot;+type2); &nbsp; &nbsp;} }</pre><h2>Output</h2><p>This will produce the following output &minus;</p><pre class="result notranslate">Typecode for val1 = UInt64 Typecode for val2 = UInt64</pre>
raja
Updated on 07-Nov-2019 06:53:06

Advertisements