- 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
George John has Published 1167 Articles
George John
3K+ Views
To display the previous day, use the AddDays() method and a value -1 to get the previous day.Firstly, use the following to get the current day −DateTime.TodayNow, add -1 to the AddDays() method to get the previous day −DateTime.Today.AddDays(-1)The following is the code −Example Live Demousing System; using System.Collections.Generic; using System.Linq; ... Read More
George John
495 Views
Firstly, set two TimeSpans −TimeSpan t1 = TimeSpan.FromMinutes(1); TimeSpan t2 = TimeSpan.FromMinutes(2);To add it, use the Add() method −TimeSpan res = t1.Add(t2);ExampleUsing System; using System.Linq; public class Demo { public static void Main() { TimeSpan t1 = TimeSpan.FromMinutes(1); TimeSpan t2 = TimeSpan.FromMinutes(2); ... Read More
George John
4K+ Views
Firstly, declare and initialize two arrays −int[] arr1 = { 37, 45, 65 }; int[] arr2 = { 70, 89, 118 };Now create a new list −var myList = new List(); myList.AddRange(arr1); myList.AddRange(arr2);Use the AddRange() method the arrays into the newly created list.myList.AddRange(arr1); myList.AddRange(arr2);Now convert the list into array as ... Read More
George John
770 Views
To replace a C# aray with a new array, use the Array.Resize.Withing that, set the size of the new array −Array.Resize(ref arr, 4);Now add the new elements to the array as shown below −Example Live Demousing System; class Program { static void Main() { char[] arr = ... Read More
George John
3K+ Views
To create an empty string array −string[] str = new string[] {};Above, we haven’t added elements to the array, since it is empty.Even if we will loop though the array, it won’t display anything as shown below −Example Live Demousing System; public class Demo { public static void Main() ... Read More
George John
7K+ Views
In a bool array, you can store true and false values. To set a bool array, use the new operator −bool[] arr = new bool[5];To add elements in the array −arr[0] = true; arr[1] = true; arr[2] = false; arr[3] = true; arr[4] = true;Let us see the complete code ... Read More
George John
488 Views
The nameof operator returns a string literal of an element that can be a variable, type or member.For example, the following is our variable −var vehicle = "motorbike";To get the string literal, use nameof −nameof(vehicle);The following is the code to implement nameof keyword −Example Live Demousing System; public class Program ... Read More
George John
2K+ Views
For File Permission in C#, use the FileIOPermission Class. It controls the ability to access files and folders.The following are the properties of File Permissions class −Sr.No.Methods & Description1AllFilesGets or sets the permitted access to all files.2AllLocalFilesGets or sets the permitted access to all local files.The following are the methods ... Read More
George John
313 Views
Let’s say our string is −var str = "welcome";Use the substring() method and the following, if you want to rotate only some characters. Here, we are rotating only 2 characters −var res = str.Substring(1, str.Length - 1) + str.Substring(0, 2);The following is the complete code −Example Live Demousing System; public ... Read More
George John
279 Views
In MySQL, we can create a view that is based on another existing view. To make it understand we are having the view ‘Info’ with the following data −mysql> Create view info AS Select Id, Name, Subject FROM student_info; Query OK, 0 rows affected (0.11 sec) mysql> Select * ... Read More