Chandu yadav has Published 1090 Articles

How we have multiple stored GENERATED COLUMNS in MySQL table with CREATE TABLE statement?

Chandu yadav

Chandu yadav

Updated on 22-Jun-2020 14:36:03

166 Views

It is quite possible to add multiple stored generated columns in a MySQL table. It can be illustrated with the following example as follows −Examplemysql> Create table profit1(cost int, price int, profit int AS (price-cost) STORED, price_revised int AS (price-2) STORED); Query OK, 0 rows affected (0.36 sec) mysql> ... Read More

All Method in C#

Chandu yadav

Chandu yadav

Updated on 22-Jun-2020 14:30:29

376 Views

The All() extension method is part of the System.Linq namepspace. Using this method, you can check whether all the elements match a certain condition or not.Set an array −int[] arr = { 6, 7, 15, 40, 55 };The following is an example. It checks whether all the elements in the ... Read More

KeyNotFoundException in C#

Chandu yadav

Chandu yadav

Updated on 22-Jun-2020 14:27:28

583 Views

The KeyNotFoundException is thrown when a key you are finding is not available in the Dictionary collection.Let us see an example −Example Live Demousing System; using System.Collections.Generic; public class Demo {    public static void Main() {       try {          var dict = new Dictionary() ... Read More

C# Program to display the last three elements from a list in reverse order

Chandu yadav

Chandu yadav

Updated on 22-Jun-2020 14:19:58

2K+ Views

To display the last three elements from a list, use the Take() method. For reversing it, use the Reverse() method.Firstly, declare a list and add elements to it −List myList = new List(); myList.Add("One"); myList.Add("Two"); myList.Add("Three"); myList.Add("Four");Now, use the Take() method with Reverse() to display the last three elements from ... Read More

Display years in different formats with C# DateTime

Chandu yadav

Chandu yadav

Updated on 22-Jun-2020 14:18:09

175 Views

Set a DateTime object;DateTime dt = DateTime.Now;To get years in different formats, try the following −dt.ToString("yy") dt.ToString("yyy") dt.ToString("yyyy") dt.ToString("yyyyy")Here is the complete code −Example Live Demousing System; using System.Threading; using System.Diagnostics; public class Demo {    public static void Main() {       DateTime dt = DateTime.Now;       ... Read More

C# program to convert string to long

Chandu yadav

Chandu yadav

Updated on 22-Jun-2020 14:15:30

15K+ Views

To convert a string to a long, use the Long.parse method in C# −Firstly, set a string −string str = "6987646475767";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 = "6987646475767"; ... Read More

TimeSpan.From methods in C# ()

Chandu yadav

Chandu yadav

Updated on 22-Jun-2020 14:12:03

170 Views

The TimeSpan.From methods include FromDays, FromHours, FromMinutes, etc.To get the TimeSpan for all the methods// Days TimeSpan t1 = TimeSpan.FromDays(1); // Hours TimeSpan t2 = TimeSpan.FromHours(1); // Minutes TimeSpan t3 = TimeSpan.FromMinutes(1);The following is the code that works on all the TimeSpan methods −Example Live Demousing System; using System.Linq; ... Read More

Format TimeSpan in C#

Chandu yadav

Chandu yadav

Updated on 22-Jun-2020 14:10:36

3K+ Views

You can format a TimeSpan in the hh: mm: ss format in C#.Firstly, set the TimeSpan −TimeSpan ts = new TimeSpan(9, 15, 30);To format TimeSpan −{0:hh\:mm\:ss}The following is the code −Example Live Demousing System; using System.Linq; public class Demo {    public static void Main() {       TimeSpan ts ... Read More

How can we use logical operators while creating MySQL views?

Chandu yadav

Chandu yadav

Updated on 22-Jun-2020 14:05:21

268 Views

MySQL views can be created by using logical operators like AND, OR, and NOT. It can be illustrated with the help of following examples −Views with AND operatorAs we know that logical AND operator compares two expressions and returns true if both the expressions are true. In the following example, ... Read More

Buffer SetByte Example in C#

Chandu yadav

Chandu yadav

Updated on 22-Jun-2020 14:03:27

301 Views

The SetByte() method assigns a specified value to a byte at a particular location in a specified array.Firstly, set an array −int[] arr = { 3, 4, 12 };Now, use SetByte() to assign values −Buffer.SetByte(arr, 3, 20);Here is the complete code −Example Live Demousing System; using System.Text; public class Demo { ... Read More

Advertisements