
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
Samual Sam has Published 2310 Articles

Samual Sam
1K+ Views
The Convert.ToDateTime method converts a given value to a DateTime value.The following is my string.string myDateString; myDateString = "09/09/2018";Now, let us convert it using the Convert.ToDateTime() method.DateTime result; result = Convert.ToDateTime(myDateString);Here is the complete example.Example Live Demousing System; public class Demo { public static void Main() { ... Read More

Samual Sam
204 Views
Set a string.char[] ch = { 'd', 'r', 'i', 'v', 'e' }; Console.Write("String = foreach(char arr in ch) Console.Write(arr);Now, use Queryable Reverse() method to invert the order of elements.IQueryable res = ch.AsQueryable().Reverse();Let us see the complete code.Example Live Demousing System; using System.Linq; using System.Collections.Generic; public class Demo { public static ... Read More

Samual Sam
3K+ Views
Set a DateTime to its minimum value.DateTime.MinValue;The above will display the minimum value i.e.1/1/0001Let us see how to display the minimum value and avoid adding null to a date to initialize it as empty.Example Live Demousing System; using System.Linq; public class Demo { public static void Main() { ... Read More

Samual Sam
525 Views
Timespan shows the length of time.To get the minimum value of TimeSpan, use the following property.TimeSpan.MinValueExample Live Demousing System; using System.Linq; public class Demo { public static void Main() { Console.WriteLine(TimeSpan.MinValue); } }Output-10675199.02:48:05.4775808

Samual Sam
10K+ Views
Set two dates.DateTime date1 = new DateTime(2018, 7, 15, 08, 15, 20); DateTime date2 = new DateTime(2018, 8, 17, 11, 14, 25);Now, get the difference between two dates.TimeSpan ts = date2 - date1;Get the result i.e. the difference in hours.ts.TotalHoursLet us see the complete code.Example Live Demousing System; using System.Linq; public ... Read More

Samual Sam
228 Views
The WindowHeight property gets or sets the height of the console window.Declare a variable.int height;Now, get the height of the current window.height = Console.WindowHeight;The following is the complete example −Example Live Demousing System; using System.Numerics; using System.Globalization; class Demo { static void Main() { int height; ... Read More

Samual Sam
8K+ Views
Let’s say the following are two DateTime objects for our dates.DateTime date1 = new DateTime(2018, 8, 11, 08, 15, 20); DateTime date2 = new DateTime(2018, 8, 11, 11, 14, 25);Find the difference between both these dates using TimeSpan.TimeSpan ts = date2 - date1;Now to get the Milliseconds, use the following ... Read More

Samual Sam
1K+ Views
Convert a specified value to a single-precision floating-point number using the Convert.ToSingle() method in C#.Here is our bool −bool boolVal = false;Now, let us use the ToSingle() method to convert the value to a single precision floating-point.float floatVal; floatVal = Convert.ToSingle(boolVal);Example Live Demousing System; public class Demo { public static ... Read More

Samual Sam
275 Views
The long type represents a 64-bit signed integer.To implicitly convert a 64-bit signed integer to a Decimal, firstly set a long value.long val = 989678876876876;To convert long to decimal, assign the value.dec = val;Let us see another example −Example Live Demousing System; public class Demo { public static void Main() ... Read More

Samual Sam
968 Views
Use File.Copy method to make copy of an existing file.Add the path of the file you want to copy.String myPath = @"D:\one.txt";Now copy the above file to the following file −String myPath = @"D:\one.txt";Use the File.Copy method with both the source and destination file.File.Copy(myPath, newpath);Exampleusing System; using System.IO; public class ... Read More