Capacity Property of ArrayList Class in C#

karthikeya Boyini
Updated on 20-Jun-2020 10:47:28

3K+ Views

The capacity property in ArrayList class gets or sets the number of elements that the ArrayList can contain.Capacity is always greater than count. For capacity property −arrList.CapacityThe default capacity is 4. If 5 elements are there, then its capacity is doubled and would be 8. This goes on.You can try to run the following the code to implement Capacity property in C#. This also shows what we discussed above −Example Live Demousing System; using System.Collections; class Demo {    public static void Main() {       ArrayList arrList = new ArrayList();       arrList.Add(19);       arrList.Add(44); ... Read More

Count Property of ArrayList Class in C#

Samual Sam
Updated on 20-Jun-2020 10:46:48

309 Views

The Count property in the ArrayList class counts the number of elements in the ArrayList.Firstly, add elements to the ArrayList −ArrayList arrList = new ArrayList(); arrList.Add(98); arrList.Add(55); arrList.Add(65); arrList.Add(34);Then get the count of the array list −arrList.CountThe following is the code to implement Count property in C# −Example Live Demousing System; using System.Collections; class Demo {    public static void Main() {       ArrayList arrList = new ArrayList();       arrList.Add(98);       arrList.Add(55);       arrList.Add(65);       arrList.Add(34);       Console.WriteLine("Count = " + arrList.Count);    } }OutputCount = 4

Use Prepared Statements in MySQL

Nikitha N
Updated on 20-Jun-2020 10:45:58

624 Views

MySQL server supports prepared statements, which are useful when we want to run many queries that differ only in very small details. We can prepare a statement and then execute it multiple times and each time with different data values. Basically, prepared statements in MySQL take advantage of client/server binary protocol. Prepared statements provide enhanced performance because the complete statement is parsed only one by the server.Followings are the steps for using prepared statements in MySQL −Prepare the statement It is the first step in which we will prepare a statement by using PREPARE statement. For example, following is a statement ... Read More

Capacity Property of SortedList Class in C#

Ankith Reddy
Updated on 20-Jun-2020 10:45:43

359 Views

The capacity property in SortedList class has the maximum size of the SortedList.The default capacity of a SortedList is 16.You can try to run the following the code to implement Capacity property of SortedList class in C# −Example Live Demousing System; using System.Collections; namespace Demo {    class Program {       static void Main(string[] args) {          SortedList s = new SortedList();          s.Add("S1", "Maths");          s.Add("S2", "Science");          s.Add("S3", "English");          s.Add("S4", "Economics");          Console.WriteLine("Capacity = " ... Read More

Declare Variables in C#

Samual Sam
Updated on 20-Jun-2020 10:44:25

418 Views

Each variable in C# has a specific type, which determines the size and layout of the variable's memory the range of values that can be stored within that memory and the set of operations that can be applied to the variable.To declare variables − ;Let us see an example to declare two integer variables −int a, b;Above the variable is of int type. Let us declare a variable for other types −Variable of float type.float f;Variable of double type.double d;Let us display a variable −Example Live Demousing System; using System.Collections; class Demo {    static void Main() {     ... Read More

Restore Multiple Databases or All Databases from mysqldump

mkotla
Updated on 20-Jun-2020 10:43:22

4K+ Views

Suppose if we have dumped multiple databases or all the databases and now want to restore it then we can do it with the following example −C:\mysql\bin>mysql -u root < tutorials_query1.sqlWith the help of above query, we are restoring the dumped multiple databases named ‘tutorials’ and ‘query1’, which are dumped in the file named ‘tutorials_query1.sql’. In this case, we do not need to write the name of the database.Similarly, with the help of the following query, we can restore all the databases dumped by mysqldump −C:\mysql\bin>mysql -u root < alldatabases.sqlWith the help of above query, we are restoring all the ... Read More

Member Functions of a Class in C#

Samual Sam
Updated on 20-Jun-2020 10:43:18

3K+ Views

A member function of a class is a function that has its definition or its prototype within the class definition similar to any other variable. It operates on an object of the class of which it is a member, and has access to all the members of a class for that object.The following is an example of a member function −public void setLength( double len ) {    length = len; } public void setBreadth( double bre ) {    breadth = bre; }The following is an example showing how to access member functions in C#.Example Live Demousing System; namespace ... Read More

MySQL QUOTE Function with Comparison Values

Arjun Thakur
Updated on 20-Jun-2020 10:42:27

155 Views

When QUOTE() function used with WHERE clause then the output depends upon the comparison values returned by WHERE clause. Following example will exhibit it −Examplemysql> Select Name, ID, QUOTE(Subject)AS Subject from Student WHERE Subject = 'History'; +-------+------+-----------+ | Name  | ID   | Subject   | +-------+------+-----------+ | Aarav | 2    | 'History' | +-------+------+-----------+ 1 row in set (0.00 sec)

Member Variables of a Class in C#

karthikeya Boyini
Updated on 20-Jun-2020 10:42:05

4K+ Views

A class is a blueprint that has member variables and functions in C#. This describes the behavior of an object.Let us see the syntax of a class to learn what are member variables − class class_name {    // member variables     variable1;     variable2;    ...     variableN;    // member methods     method1(parameter_list) {       // method body    }     method2(parameter_list) {       // method body    }    ...     methodN(parameter_list) {       // method body    } ... Read More

Backup a Single Database Using mysqldump Client Program

varma
Updated on 20-Jun-2020 10:41:02

192 Views

By using mysqldump client program we can take the backup of a database into a file having the extension ‘.sql’. it can be understood with the help of following example −ExampleIn this example, with the help of mysqldump client program, we are taking the backup of a database named ‘tutorials’ in a file named ‘tutorials.sql’. The following command will do this −C:\mysql\bin>mysqldump -u root tutorials > tutorials.sqlThe above command will create a file named ‘turorials.sql’ in the bin folder of MySQL. This file will contain drop table, create a table and insert command for all the tables in the tutorials ... Read More

Advertisements