Insert Item into a Chash List Using an Index

George John
Updated on 22-Jun-2020 12:22:30

3K+ Views

Firstly, set a list −List list = new List(); list.Add(456); list.Add(321); list.Add(123); list.Add(877); list.Add(588); list.Add(459);Now, to add an item at index 5, let say; for that, use the Insert() method −list.Insert(5, 999);Let us see the complete example −Exampleusing System; using System.Collections.Generic; namespace Demo {    public class Program {       public static void Main(string[] args) {          List list = new List();          list.Add(456);          list.Add(321);          list.Add(123);          list.Add(877);          list.Add(588);          list.Add(459);     ... Read More

Enter Characters as BINARY Number in MySQL Statement

Smita Kapse
Updated on 22-Jun-2020 12:22:22

214 Views

Following are the two approaches with the help of which we can enter characters as a BINARY number −By prefix ‘B’In this approach we need to quote binary numbers within single quotes with a prefix of B. Then BINARY number string will be automatically converted into a character string.Examplemysql> Select B'01000001'; +-------------+ | B'01000001' | +-------------+ | A           | +-------------+ 1 row in set (0.00 sec)By prefix 0bIn this approach, we need to write BINARY numbers without any quotes with a prefix of 0b. Then BINARY number string will be automatically converted into a character ... Read More

Enter Numerical Values as BINARY in MySQL Statement

vanithasree
Updated on 22-Jun-2020 12:21:32

149 Views

Following are the two approaches with the help of which we can enter numeric values as a BINARY number −By prefix ‘B’In this approach we need to quote binary numbers within single quotes with a prefix of B. Then BINARY number string will be automatically converted into a numerical value based on the expression context.Examplemysql> Select B'1110'+0; +-----------+ | B'1110'+0 | +-----------+ |        14 | +-----------+ 1 row in set (0.00 sec)By prefix 0bIn this approach, we need to write BINARY numbers without any quotes with a prefix of 0b. Then BINARY number string will be automatically ... Read More

Initialize a String to an Empty String in C#

Ankith Reddy
Updated on 22-Jun-2020 12:21:13

3K+ Views

To initialize a string to an empty list −string myStr = null;Now, use the built-in method IsNullOrEmpty() to check whether the list is empty or not −if (string.IsNullOrEmpty(myStr)) {    Console.WriteLine("String is empty or null!"); }Let us see the complete code −Example Live Demousing System; namespace Demo {    class Program {       static void Main(string[] args) {          string myStr = null;          if (string.IsNullOrEmpty(myStr)) {             Console.WriteLine("String is empty or null!");          }          Console.ReadKey();       ... Read More

Create MySQL One-Time Event That Executes Immediately

Lakshmi Srinivas
Updated on 22-Jun-2020 12:20:40

909 Views

As we know a one-time event means the events that will be executed only once on a particular schedule. To illustrate the creation of such kind of events we are using the following example in which we are creating an event which will execute at the current time −Examplemysql> Create table event_message(ID INT NOT NULL PRIMARY KEY AUTO_INCREMENT, MESSAGE VARCHAR(255) NOT NULL, Generated_at DATETIMENOT NULL); Query OK, 0 rows affected (0.61 sec) mysql> CREATE EVENT testing_event ON SCHEDULE AT CURRENT_TIMESTAMP DO INSERT INTO event_message(message, generated_at) Values('Hello', NOW()); Query OK, 0 rows affected (0.00 sec) mysql> Select * from ... Read More

Initialize a Tuple to an Empty Tuple in C#

Arjun Thakur
Updated on 22-Jun-2020 12:20:26

3K+ Views

To initialize a tuple to an empty tuple −Tuple myTuple;If you want to check for values in a tuple, that whether it is null or not −Exampleusing System; namespace Demo {    class Program {       static void Main(string[] args) {          Tuple tuple = new Tuple(10, null);          if (tuple.Item1 == 10) {             Console.WriteLine(tuple.Item1);          }          if (tuple.Item2 == null) {             Console.WriteLine("Item is null");          }       }    } }

Enter BOOLEAN Values in MySQL Statement

Anvi Jain
Updated on 22-Jun-2020 12:20:04

478 Views

As we know that there is no BOOLEAN data type in MySQL hence by using TRUE or true, FALSE or false we can enter Boolean values in MySQL statement.Examplemysql> Select TRUE,FALSE; +------+-------+ | TRUE | FALSE | +------+-------+ | 1    | 0     | +------+-------+ 1 row in set (0.00 sec) mysql> Select true,false; +------+-------+ | TRUE | FALSE | +------+-------+ | 1    | 0     | +------+-------+ 1 row in set (0.00 sec)

Get Last 4 Characters from String in C#

radhakrishna
Updated on 22-Jun-2020 12:19:58

3K+ Views

Firstly, set the string −string str = "Football and Tennis";Now, use the substring() method to get the last 4 characters −str.Substring(str.Length - 4);Let us see the complete code −Example Live Demousing System; public class Demo {    public static void Main() {       string str = "Football and Tennis";       string res = str.Substring(str.Length - 4);       Console.WriteLine(res);    } }Outputnnis

MySQL Arithmetic Expression Returns NULL

seetha
Updated on 22-Jun-2020 12:19:41

144 Views

As we know that a NULL is not a value and it is also not the same as zero. MySQL arithmetic expression returns NULL if we will use NULL in it. It can be understood with the help of the following example −Examplemysql> Select 100*NULL; +----------+ | 100*NULL | +----------+ |     NULL | +----------+ 1 row in set (0.00 sec) mysql> Select 100+NULL; +----------+ | 100+NULL | +----------+ |     NULL | +----------+ 1 row in set (0.00 sec)From the above example, it can be observed that if we will use NULL in an arithmetic expression then the result would be NULL itself.

Insert Item in List at Given Position in C#

Chandu yadav
Updated on 22-Jun-2020 12:19:34

3K+ Views

To insert an item in an already created List, use the Insert() method.Firstly, set elements −List list = new List(); list.Add(989); list.Add(345); list.Add(654); list.Add(876); list.Add(234); list.Add(909);Now, let’s say you need to insert an item at 4th position. For that, use the Insert() method −// inserting element at 4th position list.Insert(3, 567);Let us see the complete example −Exampleusing System; using System.Collections.Generic; namespace Demo {    public class Program {       public static void Main(string[] args) {          List < int > list = new List < int > ();         ... Read More

Advertisements