What is the Count property of SortedList class in C#?

Chandu yadav
Updated on 20-Jun-2020 11:02:51

157 Views

Example Live Demousing System; using System.Collections; namespace Demo {    class Program {       static void Main(string[] args) {          SortedList s = new SortedList();          s.Add("S1", "Electronics");          s.Add("S2", "Clothing");          s.Add("S3", "Applicances");          s.Add("S4", "Books");          s.Add("S5", "Accessories");          s.Add("S6", "Musical Instruments");          Console.WriteLine("Count = " + s.Count);       }    } }OutputCount = 6

How is a new object created in C#?

Samual Sam
Updated on 20-Jun-2020 11:01:50

180 Views

Like any other object-oriented language, C# also has object and classes. Objects are real-world entities and instance of a class. Access the members of the class using an object.To access the class members, you need to use the dot (.) operator after the object name. The dot operator links the name of an object with the name of a member, for example, Box Box1 = new Box();Above you can see Box1 is our object. We will use it to access the members −Box1.height = 7.0;You can also use it to call member functions −Box1.getVolume();The following is an example showing how ... Read More

What MySQL returns if I do not use the keyword ‘RIGHT’ or ‘LEFT’ while writing the query for RIGHT JOIN or LEFT JOIN?

Rishi Rathor
Updated on 20-Jun-2020 11:00:48

142 Views

In both the cases i.e. on not using ‘RIGHT’ or ‘LEFT’ keyword in the query, MySQL will return the result by taking it as INNER JOIN query. It is because the only difference between RIGHT, LEFT and INNER JOIN is the keyword of RIGHT or LEFT. To understand it, we are taking the example of two tables named tbl_1 and tbl_2 which are having following data −mysql> Select * from tbl_1; +----+--------+ | Id | Name   | +----+--------+ | 1  | Gaurav | | 2  | Rahul  | | 3  | Raman  | | 4  | Aarav  | +----+--------+ ... Read More

How is an array initialized in C#?

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

159 Views

All arrays consist of contiguous memory locations. The lowest address corresponds to the first element and the highest address to the last element.Firstly, declare an array −int[] rank;But declaring an array does not initialize the array in the memory. When the array variable is initialized, you can assign values to the array.Array is a reference type, so you need to use the new keyword to create an instance of the array. For example, int[] rank = new int[5]; You can assign values to an array at the time of declaration −int[] rank = { 1, 2, 3, 4, 5};With that, ... Read More

What are Left Shift and Right Shift Operators (>> and <<) in C#?

George John
Updated on 20-Jun-2020 11:00:02

1K+ Views

Bitwise Left shift operatorThe left operands value is moved left by the number of bits specified by the right operand.Bitwise Right shift operatorThe left operands value is moved right by the number of bits specified by the right operand.The following is an example showing how to work with Bitwise left and right shift operators −Example Live Demousing System; namespace Demo {    class Program {       static void Main(string[] args) {          int a = 60; /* 60 = 0011 1100 */          int b = 13; /* 13 = 0000 1101 */          int c = 0;          c = a > 2; /* 15 = 0000 1111 */          Console.WriteLine("Value of c is {0}", c);          Console.ReadLine();       }    } }OutputValue of c is 240 Value of c is 15

In MySQL, how can we maintain data-driven table relationship using joins?

varun
Updated on 20-Jun-2020 10:59:25

231 Views

Actually, sometimes we can avoid data-driven relationships in tables and we need to join them. It can be done with the help of CASE statement in the SELECT list to handle the joining possibilities. To understand it, we are taking the example of three data-driven tables namely ‘Student_Detail’ which have the following data −mysql> Select * from student_detail; +----+---------+ | Id | Name    | +----+---------+ | 1  | Harshit | | 2  | Rahul   | | 3  | Aarav   | +----+---------+ 3 rows in set (0.00 sec)Now, we have the three tables namely ‘Student_Harshit’, ‘Student_Rahul’, ‘Student_Aarav’ which ... Read More

C# Program to Implement Stack with Push and Pop operations

Samual Sam
Updated on 20-Jun-2020 10:59:24

785 Views

Set stack with Push operation to add elements to the Stack −Stack st = new Stack(); st.Push('A'); st.Push('M'); st.Push('G'); st.Push('W');To Pop elements from the stack, use Pop() method −st.Pop();st.Pop();The following is an example to implement a stack with Push and Pop operations −Example Live Demousing System; using System.Collections; namespace CollectionsApplication {    class Program {       static void Main(string[] args) {          Stack st = new Stack();          st.Push('A');          st.Push('M');          st.Push('G');          st.Push('W');          Console.WriteLine("Current ... Read More

What is the similarity between prepared statements and MySQL user variables?

seetha
Updated on 20-Jun-2020 10:57:22

185 Views

As we know that MySQL user variables are specific to client connection within which they are used and exist only for the duration of that connection. When a connection ends, all its user variables are lost. Similarly, the prepared statements also exist only for the duration of the session in which it is created and it is visible to the session in which it is created. When a session ends, all the prepared statements for that session are discarded.Another similarity is that prepared statements are also not case-sensitive like MySQL user variables. For example, stmt11 and STMT11 both are same ... Read More

What happens if I will prepare the statement with the same name without de-allocating the earlier one?

Prabhas
Updated on 20-Jun-2020 10:56:55

144 Views

Actually, in MySQL, we can prepare a statement with the same name without de-allocating the earlier one because MySQL automatically drops the prepared statements when they are redefined or when we close the connection to the server. In other words, we can say that we can use the same name for prepared statements without de-allocating them explicitly. But, to free the memory on the server side we must have to de-allocate them. It can be done with the help of DEALLOCATE statement as follows −DEALLOCATE PREPARE statement;Here statement is the name of the prepared statements.DROP PREPARE statements is the synonym ... Read More

What kind of SQL statements can be used to prepare statements?

Priya Pallavi
Updated on 20-Jun-2020 10:56:22

171 Views

Actually, it is not possible to prepare all SQL statements because MySQL only allows the following kinds of SQL statements that can be prepared:SELECT statementsExamplemysql> PREPARE stmt FROM 'SELECT tender_value from Tender WHERE Companyname = ?'; Query OK, 0 rows affected (0.09 sec) Statement prepared mysql> SET @A = 'Singla Group.'; Query OK, 0 rows affected (0.00 sec) mysql> EXECUTE stmt using @A; +--------------+ | tender_value | +--------------+ |   220.255997 | +--------------+ 1 row in set (0.07 sec) mysql> DEALLOCATE PREPARE stmt; Query OK, 0 rows affected (0.00 sec)INSERT, REPLACE, UPDATE and DELETEstatements that modify the ... Read More

Advertisements