Where to Use Scope Resolution Operator in C++

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

786 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

496 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

113 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

963 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

140 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)

Working with DateTime in C#

Samual Sam
Updated on 20-Jun-2020 11:16:17

818 Views

The DateTime class in C# is used to represent date and time in C#.The following are some of the properties of DateTime in C# −Sr.NoProperty & Description1DateGets the Date component2DayGets the day of the month3HourGets the hour of the month4MinuteGets the minute of the date5MonthGets the month of the dateLet us see an example to compare date in C#.To compare dates in C#, you need to first set two dates to be compared using the DateTime object. We will use the DateTime class in C# −Date 1DateTime date1 = new DateTime(2018, 07, 20); Console.WriteLine("Date 1 : {0}", date1);Date 2DateTime date2 ... Read More

Implement Differences Between Tables Using MySQL Joins

Jennifer Nicholas
Updated on 20-Jun-2020 11:11:04

99 Views

We can get the differences between the tables by unioning exclusion joins from 1st table to 2nd table and from 2nd table to 1st table. To understand it, we are taking the example of following two tables −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 ... Read More

Maximum Possible Value of an Integer in C#

karthikeya Boyini
Updated on 20-Jun-2020 11:09:37

14K+ Views

The maximum possible value of an integer is 2, 147, 483, 647.The following are the datatypes of C# with the maximum and minimum value −TypeRepresentsRangeDefault ValueboolBoolean valueTrue or FalseFalsebyte8-bit unsigned integer0 to 255char16-bit Unicode characterU +0000 to U +ffff'\0'decimal128-bit precise decimal values with 28-29 significant digits(-7.9 x 1028 to 7.9 x 1028) / 100to 280.0Mdouble64-bit double-precision floating point type(+/-)5.0 x 10-324 to (+/-)1.7 x 103080.0Dfloat32-bit single-precision floating point type-3.4 x 1038 to + 3.4 x 10380.0Fint32-bit signed integer type-2, 147, 483, 648 to 2, 147, 483, 6470long64-bit signed integer type-9, 223, 372, 036, 854, 775, 808 to 9, 223, 372, ... Read More

Working with Hashtable and Dictionary in C#

George John
Updated on 20-Jun-2020 11:08:33

400 Views

HashtableHashtable class represents a collection of key-and-value pairs that are organized based on the hash code of the key. It uses the key to access the elements in the collection.Some of the commonly used methods in Hashtable class are −Sr.No.Method & Description1public virtual void Add(object key, object value);Adds an element with the specified key and value into the Hashtable.2public virtual void Clear();Removes all elements from the Hashtable.3public virtual bool ContainsKey(object key);Determines whether the Hashtable contains a specific key.4public virtual bool ContainsValue(object value);Determines whether the Hashtable contains a specific value.The following is an example showing the usage of Hashtable class in ... Read More

Advertisements