Values Property of Hashtable Class in C#

Ankith Reddy
Updated on 20-Jun-2020 14:15:50

149 Views

The Values property gets an ICollection containing the values in the Hashtable.Declare Hashtable collection −Hashtable ht = new Hashtable();Now add valuesht.Add("One", "Henry"); ht.Add("Two", "Kevin"); ht.Add("Three", "David");To display values from Hashtable, the following is the code −Example Live Demousing System; using System.Collections; namespace Demo {    class Program {       static void Main(string[] args) {          Hashtable ht = new Hashtable();          ht.Add("One", "Henry");          ht.Add("Two", "Kevin");          ht.Add("Three", "David");          // Displaying values          foreach (string value in ht.Values) {             Console.WriteLine(value);          }          Console.ReadKey();       }    } }OutputDavid Henry Kevin

Values Property of SortedList Class in C#

Samual Sam
Updated on 20-Jun-2020 14:15:10

109 Views

Firstly, declare the SortedList class −SortedList list = new SortedList();Now add the values −list.Add("S1", "Wallets"); list.Add("S2", "Sunglasses"); list.Add("S3", "Backpacks");The following is the code to work with Values property of SortedList class −Example Live Demousing System; using System.Collections; namespace Demo {    class Program {       static void Main(string[] args) {          SortedList list = new SortedList();          list.Add("S1", "Wallets");          list.Add("S2", "Sunglasses");          list.Add("S3", "Backpacks");          foreach (string value in list.Values) {             Console.WriteLine(value);          }       }    } }OutputWallets Sunglasses Backpacks

Calculate Power of Three Using C#

George John
Updated on 20-Jun-2020 14:13:57

363 Views

For power of 3, se the power as 3 and apply a recursive code like the following snippet −if (p!=0) { return (n * power(n, p - 1)); }Let’s say the number is 5, then the iterations would be −power(5, 3 - 1)); // 25 power (5,2-1): // 5The above would return5*25 i.e 125 as shown below −Example Live Demousing System; using System.IO; public class Demo {    public static void Main(string[] args) {       int n = 5;       int p = 3;       long res;       res = power(n, p);       Console.WriteLine(res);    }    static long power (int n, int p) {       if (p!=0) {          return (n * power(n, p - 1));       }       return 1;    } }Output125

MySQL Evaluation of Non-Numeric Text Before Numbers in Quotes

Anjana
Updated on 20-Jun-2020 13:58:45

93 Views

Suppose if we are trying to add the numbers having non-numeric text before them, then MySQL simply evaluate the value of such number as 0. Following example will exhibit this −Examplemysql> Select 'Kg 1525' + 'Oz 200'As Total; +-------+ | Total | +-------+ | 0     | +-------+ 1 row in set, 2 warnings (0.00 sec) mysql> Select 'Kg 1525' + '200'As Total; +-------+ | Total | +-------+ | 200   | +-------+ 1 row in set, 1 warning (0.00 sec)

Get MySQL Server-Side Help

radhakrishna
Updated on 20-Jun-2020 13:57:21

215 Views

MySQL provides help command to get server-side help. The syntax of this command is as follows −mysql> help search_stringMySQL uses the argument of help command as the search string for accessing the contents of MySQL reference manual. The search will fail if there would be no match for the search string.For example − suppose I want to get server-side help regarding INTEGER data type then the command for the same would be as follows −mysql> help INTEGER Name: 'INTEGER' Description: INTEGER[(M)] [UNSIGNED] [ZEROFILL] This type is a synonym for INT. URL: http://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.htmlRead More

Calculate Date in MySQL Using Functions

Ayyan
Updated on 20-Jun-2020 13:55:26

196 Views

In MySQL, we can use the following functions to calculate the Date −CURDATE() Function − Basically it returns the current date of the computer.YEAR() Function − It returns the year of the specified date.MONTH() function − It returns the month of the specified date.DAY() Function − It returns the day of the specified date.RIGHT() Function − It returns the number of character as specified within the function from the given date. The part of the expression that compares the returns from RIGHT() function evaluates 1 or 0.To understand it, consider the data, as follows, from a table named ‘Collegedetail’ −mysql> ... Read More

Use ORDER BY Clause While Calculating Date

Kumar Varma
Updated on 20-Jun-2020 13:53:46

167 Views

It would be more convenient to find a record if we will use ORDER BY clause while calculating the date. To understand it, we have the data from table ‘Collegedetail’ as follows −mysql> Select * from Collegedetail; +------+---------+------------+ | ID   | Country | Estb       | +------+---------+------------+ | 111  | INDIA   | 2010-05-01 | | 130  | INDIA   | 1995-10-25 | | 139  | USA     | 1994-09-25 | | 1539 | UK      | 2001-07-23 | | 1545 | Russia  | 2010-07-30 | +------+---------+------------+ 5 rows in set (0.00 sec)Now, suppose if ... Read More

Authentication for MySQL Command Line Tool Login

Prabhas
Updated on 20-Jun-2020 13:52:19

174 Views

Yes, we require authentication for login into MySQL command line tool. For example, if we are trying to log in from windows command line then it will prompt for the password every time. The command for login is as follows −C:\Program Files\MySQL\bin>mysql -u root -p Enter password: *****

Web Fonts in CSS

vanithasree
Updated on 20-Jun-2020 13:51:17

90 Views

Web fonts are used to allow the fonts in CSS, which are not installed on a local system. ExampleThe following code shows the sample code of font face:Live Demo                    @font-face {             font-family: myFirstFont;             src: url(/css/font/SansationLight.woff);          }          div {             font-family: myFirstFont;          }                     This is the example of font face with CSS3.       Original Text :This is the example of font face with CSS3.     Output

Combine Strings with Separator in MySQL

Chandu yadav
Updated on 20-Jun-2020 13:50:36

180 Views

In MySQL, we can combine two or more strings along with a separator by using CONCAT_WS() function. The syntax of this function is CONCAT_WS(Separator, String1, String2, …, StringN)Here, the arguments of CONCAT_WS functions are Separator and the strings which need to be concatenated along with that separator as a single string. Separator except for numeric value must enclose within quotes.Examplemysql> Select CONCAT_WS('.', 'www', 'tutorialspoint', 'com'); +---------------------------------------------+ | CONCAT_WS('.', 'www', 'tutorialspoint', 'com') | +---------------------------------------------+ | www.tutorialspoint.com                      | +---------------------------------------------+ 1 row in set (0.00 sec)In this example above, we can see that the separator ... Read More

Advertisements