AmitDiwan

AmitDiwan

8,390 Articles Published

Articles by AmitDiwan

Page 675 of 839

How to fetch the newly added records from a MySQL table?

AmitDiwan
AmitDiwan
Updated on 11-Dec-2019 655 Views

For this, you can use ORDER BY with LIMIT. Here, LIMIT is used to set the limit (count) of records you want to fetch. Let us first create a table −mysql> create table DemoTable1486    -> (    -> StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> StudentName varchar(20)    -> ); Query OK, 0 rows affected (0.66 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1486(StudentName) values('Chris Brown'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable1486(StudentName) values('David Miller'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable1486(StudentName) values('John Doe'); ...

Read More

How to play Beep sound through Console in C#?

AmitDiwan
AmitDiwan
Updated on 11-Dec-2019 321 Views

To play beep sound through Console, the code is as follows −Example Live Demousing System; public class Demo {    public static void Main(String[] args){       Console.WriteLine("Displaying standard output stream...");       Console.WriteLine("Standard Output Stream = "+Console.Out);       Console.WriteLine("Beep sound through Console");       Console.Beep();    } }OutputThis will produce the following output −Displaying standard output stream... Standard Output Stream = System.IO.TextWriter+SyncTextWriter Beep sound through ConsoleExampleLet us now see another example − Live Demousing System; public class Demo {    public static void Main(String[] args){       Console.WriteLine("Displaying standard output stream...");       Console.WriteLine("Standard ...

Read More

How to perform a specified action on each element of the List in C#?

AmitDiwan
AmitDiwan
Updated on 11-Dec-2019 267 Views

To perform a specified action on each element of the List, the code is as follows −Example Live Demousing System; using System.Collections.Generic; public class Demo {    public static void demo(int s){       s = s * 10;       Console.WriteLine(s);    }    public static void Main(String[] args){       List list = new List();       list.Add(25);       list.Add(50);       list.Add(75);       list.Add(100);       list.Add(200);       list.Add(250);       list.Add(275);       list.Add(300);       Console.WriteLine("List...");       foreach (int ...

Read More

How to get TypeCode in C#?

AmitDiwan
AmitDiwan
Updated on 10-Dec-2019 234 Views

To get TypeCode in C#, the code is as follows −Example Live Demousing System; public class Demo {    public static void Main(){       string s = "Demo";       Console.WriteLine("String = " +s);       Console.WriteLine("String Type = " +s.GetType());       Console.WriteLine("GetTypeCode = " +s.GetTypeCode());    } }OutputThis will produce the following output −String = Demo String Type = System.String GetTypeCode = StringExampleLet us now see another example − Live Demousing System; public class Demo {    public static void Main(){       int i = 100;       double d = 5.26d; ...

Read More

How to get the Standard Input and Output Stream through Console in C#?

AmitDiwan
AmitDiwan
Updated on 10-Dec-2019 448 Views

To get the standard input stream through Console, the code is as follows −Example Live Demousing System; public class Demo {    public static void Main(string[] args){       Console.WriteLine("Displaying standard input stream...");       Console.WriteLine("Standard Input Stream = "+Console.In);    } }OutputThis will produce the following output −Displaying standard input stream... Standard Input Stream = System.IO.TextReader+SyncTextReaderExampleLet us now see an example to display standard output stream − Live Demousing System; public class Demo {    public static void Main(string[] args){       Console.WriteLine("Displaying standard output stream...");       Console.WriteLine("Standard Output Stream = "+Console.Out);    } }OutputThis will ...

Read More

How to get the remaining elements of the Tuple in C#?

AmitDiwan
AmitDiwan
Updated on 10-Dec-2019 146 Views

To get the remaining elements of the Tuple, the Rest property is used. The code is as follows −Example Live Demousing System; public class Demo {    public static void Main(String[] args){       var tuple1 = Tuple.Create(75, 200, 500, 700, 100, 1200, 1500, 2000);       var tuple2 = Tuple.Create(75, 200, 500, 700, 100, 1200, 1500, 2000);       Console.WriteLine("Is Tuple1 equal to Tuple2? = "+tuple1.Equals(tuple2));       Console.WriteLine("HashCode of Tuple1 = "+tuple1.GetHashCode());       Console.WriteLine("HashCode of Tuple2 = "+tuple2.GetHashCode());       Console.WriteLine("Tuple1 Item 1st = "+tuple1.Item1);       Console.WriteLine("Tuple2 Item 1st ...

Read More

First occurrence in the List that matches the specified conditions in C#

AmitDiwan
AmitDiwan
Updated on 10-Dec-2019 515 Views

To get the first occurrence in the list that matches the specified conditions, the code is as follows −Example Live Demousing System; using System.Collections.Generic; public class Demo {    private static bool demo(int i){       return ((i % 10) == 0);    }    public static void Main(String[] args){       List list = new List();       list.Add(200);       list.Add(215);       list.Add(310);       list.Add(500);       list.Add(600);       Console.WriteLine("List elements...");       foreach (int i in list){          Console.WriteLine(i);       } ...

Read More

Find the first node in LinkedList containing the specified value in C#

AmitDiwan
AmitDiwan
Updated on 10-Dec-2019 136 Views

To find the first node in LinkedList containing the specified value, the code is as follows −Example Live Demousing System; using System.Collections.Generic; public class Demo {    public static void Main(){       LinkedList list = new LinkedList();       list.AddLast("John");       list.AddLast("Tim");       list.AddLast("Kevin");       list.AddLast("Jacob");       list.AddLast("Emma");       list.AddLast("Ryan");       list.AddLast("Brad");       list.AddLast("Carl");       Console.WriteLine("LinkedList elements...");       foreach(string str in list){          Console.WriteLine(str);       }       LinkedListNode val = list.Find("Jacob");     ...

Read More

Enumerator that iterates through the BitArray in C#

AmitDiwan
AmitDiwan
Updated on 10-Dec-2019 178 Views

Following is the code that iterates through the BitArray with Enumerator −Example Live Demousing System; using System.Collections; public class Demo {    public static void Main(){       BitArray arr1 = new BitArray(5);       BitArray arr2 = new BitArray(5);       arr1[0] = false;       arr1[1] = true;       arr1[2] = false;       arr1[3] = true;       arr1[4] = true;       Console.WriteLine("Enumerator that iterates through BitArray1");       IEnumerable demoEnum = arr1;       foreach(Object ob in demoEnum){          Console.WriteLine(ob);     ...

Read More

Creating StringBuilder having specified capacity in C#

AmitDiwan
AmitDiwan
Updated on 10-Dec-2019 138 Views

To create StringBuilder having specified capacity, the code is as follows −Example Live Demousing System; using System.Text; public class Demo {    public static void Main(String[] args){       StringBuilder strBuilder1 = new StringBuilder("Tim");       StringBuilder strBuilder2 = new StringBuilder("Tom");       StringBuilder strBuilder3 = new StringBuilder();       StringBuilder strBuilder4 = new StringBuilder(5);       strBuilder2 = strBuilder3;       Console.WriteLine("Is StringBuilder3 equal to StringBuilder2? = "+strBuilder3.Equals(strBuilder2));       Console.WriteLine("StringBuider1 capacity = "+strBuilder1.Capacity);       Console.WriteLine("StringBuider2 capacity = "+strBuilder2.Capacity);       Console.WriteLine("StringBuider3 capacity = "+strBuilder3.Capacity);       Console.WriteLine("StringBuider4 capacity ...

Read More
Showing 6741–6750 of 8,390 articles
« Prev 1 673 674 675 676 677 839 Next »
Advertisements