- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Karthikeya Boyini has Published 2383 Articles
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
karthikeya Boyini
269 Views
The following is our string −string myStr = "5";To check whether the above is a string with numeric representation, use TryParse and out.int.TryParse(myStr, out a);Here is the complete code.Example Live Demousing System.IO; using System; class Program { static void Main() { bool res; int ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
karthikeya Boyini
3K+ Views
Declare an array and add elements.int[] val = { 5, 8, 15, 25, 40, 55, 80, 100 };Now, use the Queryable Last() method to get the last element.val.AsQueryable().Last();Let us see the complete code.Example Live Demousing System; using System.Collections.Generic; using System.Linq; class Demo { static void Main() { ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
karthikeya Boyini
379 Views
Fibonacci numbers are the numbers such that every number in the series after the first two is the sum of the two preceding ones. The series starts with 1, 1. Example −1, 1, 2, 3, 5, 8, 13, 21, 34, ….We can write a program to generate nth as follows −functionfibNaive(n) { if (n
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
karthikeya Boyini
154 Views
The GetTempPath() method in C# displays temporary file names −Path.GetTempPath();Get the names in a variable and display −string tempFile = Path.GetTempPath();The following is the code −Example Live Demousing System; using System.IO; class Demo { static void Main() { string tempFile = Path.GetTempPath(); Console.WriteLine(tempFile); } }Output/tmp/
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
karthikeya Boyini
2K+ Views
Declare an array −int[] arr = { 20, 50, -35, 25, 60 };Now to get the largest element from an array, use the Max() method −arr.Max());Here is the complete code −Example Live Demousing System; using System.Linq; class Demo { static void Main() { int[] arr = { 20, 50, -35, 25, 60 }; Console.WriteLine(arr.Max()); } }Output60
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
karthikeya Boyini
123 Views
Use the group by the operator in C# to separate the results of an expression into parts.Let’s say the following is our array −int[] a = { 5, 10, 15, 20, 25, 30 };Now, using Group by and orderby, we will find the elements greater than 20 −var check = ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
karthikeya Boyini
1K+ Views
To convert a string to a long, use the Long.parse method in C# −Firstly, set a string −string str = "7864646475767";Now, convert it to long −long.Parse(str);Here is the complete code −Example Live Demousing System; using System.Linq; class Demo { static void Main() { string str = "7864646475767"; ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
karthikeya Boyini
606 Views
The ToEven property is used with the MidpointRounding Enumeration to round a number to the nearest even number.Declare and initialize a decimal number −decimal val = 25.55M;To round a number to the nearest even number −decimal.Round(val, 0, MidpointRounding.ToEven)Here is the complete code −Example Live Demousing System; using System.Linq; class Demo { ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
karthikeya Boyini
2K+ Views
Decimal type has constants to get the minimum and maximum values.Set a decimal value −decimal d = 5.8M;To get the minimum and maximum values of the decimal type, use the following properties −decimal.MaxValue decimal.MinValueHere is the complete code −Example Live Demousing System; using System.Linq; class Demo { static void Main() ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
karthikeya Boyini
2K+ Views
To get the last write time of a file in C#, use the LastWriteTime() method.For this, use the FileInfo as well as DateTime classes.Create an object of each −FileInfo file = new FileInfo("amit.txt"); DateTime dt = file.CreationTime; dt = file.LastWriteTime;Let us see the complete code −Example Live Demousing System.IO; using System; ... Read More