AmitDiwan has Published 10740 Articles

Add element to HashSet in C#

AmitDiwan

AmitDiwan

Updated on 10-Dec-2019 09:47:07

338 Views

To add the element to HashSet, the code is as follows −Example Live Demousing System; using System.Collections.Generic; public class Demo {    public static void Main(String[] args){       HashSet set1 = new HashSet();       set1.Add("A");       set1.Add("B");       set1.Add("C");       set1.Add("D"); ... Read More

Get the fields of the current Type in C#

AmitDiwan

AmitDiwan

Updated on 10-Dec-2019 09:45:21

311 Views

To get the fields of the current Type, the code is as follows −Example Live Demousing System; using System.Reflection; public class Demo {    public static void Main() {       Type type = typeof(System.String);       FieldInfo [] fields = type.GetFields(BindingFlags.Static | BindingFlags.NonPublic);       Console.WriteLine ("Following ... Read More

Get the handle for the Type of a specified object C#

AmitDiwan

AmitDiwan

Updated on 10-Dec-2019 09:41:48

254 Views

To get the handle for the Type of a specified object, the code is as follows −Example Live Demousing System; public class Demo {    public static void Main() {       Type type1 = typeof(System.Type);       RuntimeTypeHandle typeHandle = Type.GetTypeHandle(type1);       Type type = Type.GetTypeFromHandle(typeHandle); ... Read More

Check whether the Dictionary has the specified key or not in C#

AmitDiwan

AmitDiwan

Updated on 10-Dec-2019 09:39:46

176 Views

To check whether the Dictionary has the specified key or not, the code is as follows −Example Live Demousing System; using System.Collections.Generic; public class Demo {    public static void Main() {       Dictionary dict =       new Dictionary();       dict.Add("One", "John");       ... Read More

Perform multiple counting without using MySQL COUNT()?

AmitDiwan

AmitDiwan

Updated on 10-Dec-2019 08:17:27

299 Views

To count, you can use SUM() along with CASE statement for conditions. Let us first create a table −mysql> create table DemoTable1485    -> (    -> StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> StudentName varchar(20),    -> StudentSubject varchar(20)    -> ); Query OK, 0 rows affected ... Read More

Indicate whether the specified Unicode character is white space in C#

AmitDiwan

AmitDiwan

Updated on 10-Dec-2019 08:16:29

245 Views

To indicate whether the specified Unicode character is white space, the code is as follows −Example Live Demousing System; public class Demo {    public static void Main() {       bool res;       char val = ' ';       Console.WriteLine("Value = "+val);       ... Read More

Insert MAX(col)+1 into the same MySQL table?

AmitDiwan

AmitDiwan

Updated on 10-Dec-2019 08:15:01

626 Views

Let us first create a table −mysql> create table DemoTable1484    -> (    -> Id int    -> ); Query OK, 0 rows affected (0.46 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1484 values(100); Query OK, 1 row affected (0.25 sec) mysql> insert into ... Read More

StringCollection Class in C#

AmitDiwan

AmitDiwan

Updated on 10-Dec-2019 08:13:49

829 Views

The StringCollection class represents a collection of strings. Following are the properties of the StringCollection class −Sr.noProperty & Description1CountGets the number of key/values pairs contained in the OrderedDictionary collection.2IsReadOnlyGets a value indicating whether the StringCollection is read-only..3IsSynchronizedGets a value indicating whether access to the StringCollection is synchronized (thread safe).4Item[Int32]Gets or ... Read More

Perform MySQL SELECT INTO user-defined variable

AmitDiwan

AmitDiwan

Updated on 10-Dec-2019 08:11:30

293 Views

Let us first create a table −mysql> create table DemoTable1483    -> (    -> Salary int    -> ); Query OK, 0 rows affected (0.41 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1483 values(100); Query OK, 1 row affected (0.17 sec) mysql> insert into ... Read More

How to display the result more readable if the string is long stored in MySQL VARCHAR?

AmitDiwan

AmitDiwan

Updated on 10-Dec-2019 08:09:14

464 Views

For this, use \G as in the below syntax −select * from yourTableName\GLet us first create a table −mysql> create table DemoTable1482    -> (    -> Title varchar(255)    -> ); Query OK, 0 rows affected (0.52 sec)Insert some records in the table using insert command −mysql> insert into ... Read More

Advertisements