Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Server Side Programming Articles - Page 2110 of 2650
117 Views
The Type.GetEnumUnderlyingType() method in C# is used to return the underlying type of the current enumeration type.SyntaxFollowing is the syntax −public virtual Type GetEnumUnderlyingType ();ExampleLet us now see an example to implement the Type.GetEnumUnderlyingType() method −using System; public class Demo { enum Vehicle {Car, Bus, Bike, Airplane} public static void Main(){ try { Vehicle v = Vehicle.Bike; Type type = v.GetType(); string[] str = type.GetEnumNames(); Console.WriteLine("GetEnumName() to return the constant name = " + str); ... Read More
103 Views
The Type.GetEnumNames() method in C# is used to return the names of the members of the current enumeration type.SyntaxFollowing is the syntax −public virtual string[] GetEnumNames ();ExampleLet us now see an example to implement the Type.GetEnumNames() method −using System; public class Demo { enum Vehicle {Car, Bus, Bike} public static void Main(){ try { Type type = typeof(string); string[] str = type.GetEnumNames(); Console.WriteLine("GetEnumName() to return the constant name = " + str); Console.WriteLine("Listing constants .."); ... Read More
164 Views
The Tuple class represents a 1-tuple, which is called singleton. A tuple is a data structure that has a sequence of elements.ExampleLet us now see an example to implement the 1-tuple in C# −using System; public class Demo { public static void Main(string[] args) { Tuple tuple = new Tuple(100); Console.WriteLine("Value = " + tuple.Item1); if (tuple.Item1 == 150) { Console.WriteLine(tuple.Item1); } if (tuple.Item1 == 100) { Console.WriteLine(tuple.Item1); } } }OutputThis will ... Read More
912 Views
The DateTimeOffset.FromUnixTimeSeconds() method in C# is used to convert a Unix time expressed as the number of seconds that have elapsed since 1970-01-01T00:00:00Z to a DateTimeOffset value.SyntaxFollowing is the syntax −public static DateTimeOffset FromUnixTimeSeconds (long val);Above, the parameter value is a Unix time, expressed as the number of seconds that have elapsed since 1970-01-01T00:00:00Z (January 1, 1970, at 12:00 AM UTC).ExampleLet us now see an example to implement the DateTimeOffset.FromUnixTimeSeconds() method −using System; public class Demo { public static void Main() { DateTimeOffset offset = DateTimeOffset.FromUnixTimeSeconds(20); Console.WriteLine("DateTimeOffset = {0} ", offset); ... Read More
1K+ Views
The DateTimeOffset.FromUnixTimeMilliseconds() method in C# is used to convert a Unix time expressed as the number of milliseconds that have elapsed since 1970-01-01T00:00:00Z to a DateTimeOffset value.SyntaxFollowing is the syntax −public static DateTimeOffset FromUnixTimeMilliseconds (long val);Above, Val are the milliseconds that have elapsed since 1970-01-01T00:00:00Z (January 1, 1970, at 12:00 AM UTC).ExampleLet us now see an example to implement the DateTimeOffset.FromUnixTimeMilliseconds() method −using System; public class Demo { public static void Main() { DateTimeOffset offset = DateTimeOffset.FromUnixTimeMilliseconds(30000); Console.WriteLine("DateTimeOffset = {0} ", offset); Console.WriteLine("DateTimeOffset (other format) = {0:dd} {0:y}, {0:hh}:{0:mm}:{0:ss} ", ... Read More
56 Views
The DateTimeOffset.FromFileTime() method in C# is used to convert the specified Windows file time to an equivalent local time.SyntaxFollowing is the syntax −public static DateTimeOffset FromFileTime (long time);Above, time is the Windows file time, in ticks.ExampleLet us now see an example to implement the DateTimeOffset.FromFileTime() method −using System; public class Demo { public static void Main() { DateTimeOffset offset = DateTimeOffset.FromFileTime(0); Console.WriteLine("DateTimeOffset = {0:dd} {0:y}, {0:hh}:{0:mm}:{0:ss} ", offset); } }OutputThis will produce the following output −DateTimeOffset = 01 January 1601, 12:00:00ExampleLet us now see another example to implement the DateTimeOffset.FromFileTime() method −using ... Read More
80 Views
The Type.GetEnumName() method in C# returns the name of the constant that has the specified value, for the current enumeration type.SyntaxFollowing is the syntax −public virtual string GetEnumName (object val);Above, Val is the value whose name is to be retrieved.ExampleLet us now see an example to implement the Type.GetEnumName() method −using System; public class Demo { enum Vehicle {Car, Bus, Bike} public static void Main(){ Vehicle v = Vehicle.Bike; Type type = v.GetType(); string str = type.GetEnumName(v); Console.WriteLine("GetEnumName() to return the constant name = " + ... Read More
232 Views
The Type.GetElementType() method in C# is used to return the Type of the object encompassed or referred to by the current array, pointer or reference type.SyntaxFollowing is the syntax −public abstract Type GetElementType ();ExampleLet us now see an example to implement the Type.GetElementType() method −using System; public class Demo { public static void Main(){ string[] arr = {"tom", "amit", "kevin", "katie"}; Type t1 = arr.GetType(); Type t2 = t1.GetElementType(); Console.WriteLine("Type = "+t2.ToString()); } }OutputThis will produce the following output −Type = System.StringExampleLet us now see another ... Read More
160 Views
The Tuple class represents a 4-tuple, which is called quadruple. A tuple is a data structure that has sequence of elements.It is used in −Easier access to a data set.Easier manipulation of a data set.To represent a single set of data.To return multiple values from a methodTo pass multiple values to a methodIt has four properties −Item1 − Get the value of the current Tuple object's first component.Item2 − Get the value of the current Tuple object's second component.Item3 − Get the value of the current Tuple object's third component.Item4 − Get the value of the current Tuple object's fourth ... Read More
246 Views
The Math.Tan() method in C# is used to return the tangent of the specified angle.SyntaxFollowing is the syntax −public static double Tan (double val);Here, Val is the angle.ExampleLet us now see an example to implement Math.Tan() method −using System; public class Demo { public static void Main(){ double val1 = 30.0; Console.WriteLine(Math.Tan( (val1 * (Math.PI)) / 180 )); } }SyntaxThis will produce the following output −0.577350269189626ExampleLet us see another example to implement Math.Tan() method −using System; public class Demo { public static void Main(){ double val1 = 45.0; ... Read More