RemoveAt Method in C# Lists

karthikeya Boyini
Updated on 20-Jun-2020 11:20:30

5K+ Views

The RemoveAt() method in C# is used to remove an element in a list at a position you set.Firstly, set elements in the list −var subjects = new List(); subjects.Add("Physics"); subjects.Add("Chemistry"); subjects.Add("Biology"); subjects.Add("Science");To remove an element, set the index from where you want to eliminate the element. The following is to remove an element from the 3rd position −subjects.RemoveAt(2);Let us see the complete code −Example Live Demousing System; using System.Collections.Generic; public class Demo {    public static void Main(string[] args) {       var subjects = new List();       subjects.Add("Physics");       subjects.Add("Chemistry");       ... Read More

Check if MySQL Server is Alive

Krantik Chavan
Updated on 20-Jun-2020 11:20:21

388 Views

With the help of ‘mysqladmin’ program, we would be able to know whether our MySQLserver is alive or not. It can be used as follows on the command line −C:\mysql\bin>mysqladmin -u root ping mysqld is aliveThe message after running the command shows that our MySQL server is alive.

Why Use Comma Operator in C#

Samual Sam
Updated on 20-Jun-2020 11:19:46

926 Views

Comma operator in C# can be used as a separator in method argument list. You can also use it is an operator in a for statement.The following is an example showing using a comma operator in a for statement for initialization −for (int i = begin, j = 1; i

Check the Version of MySQL Server

Priya Pallavi
Updated on 20-Jun-2020 11:19:18

502 Views

With the help of ‘mysqladmin’ program we would be able to know about the version of our MySQL server. To get the version we should have to write the following command on command line −C:\mysql\bin>mysqladmin -u root version mysqladmin Ver 8.42 Distrib 5.7.20, for Win64 on x86_64 Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Server version       5.7.20 Protocol version     10 Connection           localhost via TCP/IP TCP port   ... Read More

Where to Use Scope Resolution Operator in C++

Arjun Thakur
Updated on 20-Jun-2020 11:18:56

811 Views

In C++ the scope resolution operator i.e. :: is used for global variables, whereas in C# it is related to namespaces.If you have a type that share an identifier in different namespace, then to identify them use the scope resolution operator.For example, to reference System.Console class, use the global namespace alias with the scope resolution operator −global::System.ConsoleLet us see an example −Example Live Demousing myAlias = System.Collections; namespace Program {    class Demo {       static void Main() {          myAlias::Hashtable h = new myAlias::Hashtable();          h.Add("M", "1");       ... Read More

Shutdown MySQL Server

Daniol Thomas
Updated on 20-Jun-2020 11:18:42

514 Views

With the help of ‘mysqladmin’ program we would be able to shutdown our MySQL server. It can be used as follows on command line −C:\mysql\bin>mysqladmin -u root shutdownWe will see nothing after entering the above command because it will not print any message in command window. We should have to trust that MySQL server has been shutdown properly.

How is an Array Declared in C#

karthikeya Boyini
Updated on 20-Jun-2020 11:18:23

122 Views

To declare an array in C#, you can use the following syntax −datatype[ ] Name_of_array;Here, datatype is used to specify the type of elements in the array.[ ] specifies the size of the array.Name_of_array specifies the name of the array.The following is an example −double[ ] balance;Let us see an example in which an array is declared and values are added to it −Example Live Demousing System; namespace ArrayApplication {    class MyArray {       static void Main(string[] args) {          int [ ] n = new int[10]; /* n is an array of 10 ... Read More

Why is the Main Method Used as Static in C#

Chandu yadav
Updated on 20-Jun-2020 11:17:28

3K+ Views

The Main method states what the class does when executed and instantiates other objects and variables.A main method is static since it is available to run when the C# program starts. It is the entry point of the program and runs without even creating an instance of the class.The following shows how to add a Main() method with static −Example Live Demousing System; namespace Demo {    class HelloWorld {       static void Main(string[] args) {          Console.WriteLine("Bingo!");          Console.ReadKey();       }    } }OutputBingo!As you can see in ... Read More

Subtract Values in MySQL Table using LEFT JOIN

Vrundesha Joshi
Updated on 20-Jun-2020 11:17:24

992 Views

It can be understood with the help of an example in which two tables are having some values and we subtract the values with the help of LEFT JOIN. Here we are taking two tables having the following data −mysql> Select * from value_curdate; +----+----------+-------+ | Id | Product  | Price | +----+----------+-------+ | 1  | Notebook | 100   | | 2  | Pen      | 40    | | 3  | Pencil   | 65    | +----+----------+-------+ 3 rows in set (0.00 sec) mysql> Select * from value_prevdate; +----+-----------+-------+ | Id | Product   | ... Read More

Implement Intersection Between Tables Using MySQL Joins

usharani
Updated on 20-Jun-2020 11:16:54

150 Views

Actually, INTERSECTION is just an inner join on all columns. We are taking a simple example of two tables, having the data as follows −mysql> Select * from value1; +------+------+ | i    | j    | +------+------+ | 1    | 1    | | 2    | 2    | +------+------+ 2 rows in set (0.00 sec) mysql> Select * from value2; +------+------+ | i    | j    | +------+------+ | 1    | 1    | | 3    | 3    | +------+------+ 2 rows in set (0.00 sec)Now, the following query will do the INTERSECTION between these tables −mysql> Select * from value1 join value2 using(i,j); +------+------+ | i    | j    | +------+------+ | 1    | 1    | +------+------+ 1 row in set (0.08 sec)

Advertisements