Arjun Thakur has Published 1109 Articles

Enum.GetNames in C#

Arjun Thakur

Arjun Thakur

Updated on 22-Jun-2020 13:57:05

24 Views

It gets an array of the names of constants in an enumeration. The following is the syntax −Enum.GetNames(Type)Here, Type is an enumeration type.The following is an example −Example Live Demousing System; class Demo {    enum Vehicle {       Car,       Motorbike,       Truck, ... Read More

Buffer Type in C#

Arjun Thakur

Arjun Thakur

Updated on 22-Jun-2020 13:54:56

480 Views

To handle range of bytes, use Buffer Type in C#. Its method Buffer.BlockCopy copies the bytes from one byte array to another byte array.Example Live Demousing System; class Demo {    static void Main() {       // byte arrays       byte[] b1 = new byte[] {39, 45, ... Read More

Buffer GetByte Example in C#

Arjun Thakur

Arjun Thakur

Updated on 22-Jun-2020 13:52:38

156 Views

Read individual bytes using GetByte() method in C# −Set an array −int[] arr = { 3, 4, 12 };Now, use Buffer.GetByte() to display the array elements and to read individual bytes −for (int i = 0; i < Buffer.ByteLength(arr); i++) {    Console.WriteLine(Buffer.GetByte(arr, i)); }The following is the code −Example Live ... Read More

C# program to join words into a string in C#

Arjun Thakur

Arjun Thakur

Updated on 22-Jun-2020 13:50:17

182 Views

Declare a string and add elements −string[] str = { "One", "Two", "Three", "Four", "Five" };Use the Join() method to join the words−string res = string.Join(" ", str);Let us see the complete code −Example Live Demousing System; public class Demo {    public static void Main() {       ... Read More

Default value of StringBuilder in C#

Arjun Thakur

Arjun Thakur

Updated on 22-Jun-2020 13:48:23

425 Views

Use the default operator to get the default value of StringBuilder.StringBuilder str = default(StringBuilder);Above, we have used the default keywords to get the default value.Let us see the complete code −Example Live Demousing System; using System.Text; public class Demo {    public static void Main() {       StringBuilder ... Read More

How can we get the structure of a MySQL view as we can get the structure of a MySQL table?

Arjun Thakur

Arjun Thakur

Updated on 22-Jun-2020 13:41:44

297 Views

As we know that views are a type of virtual tables and are a composition of tables too hence we can use the same query to get the structure of a view which we use to get the structure of a table. In other words, we can use DESCRIBE statement to get ... Read More

Swapping Characters of a String in C#

Arjun Thakur

Arjun Thakur

Updated on 22-Jun-2020 13:06:49

2K+ Views

To swap characters of a string, use the Select method.Firstly, let’s say our string is −string str = "PQRQP";Now, you need to swap every occurrence of P with Q and Q with P −str.Select(a=> a == 'P' ? 'Q' : (a=='Q' ? 'P' : a)).ToArray();The above replaces the characters.Let us ... Read More

C# program to find Union of two or more Lists

Arjun Thakur

Arjun Thakur

Updated on 22-Jun-2020 13:01:22

900 Views

Firstly, create lists −//three lists var list1 = new List{3, 4, 5}; var list2 = new List{1, 2, 3, 4, 5}; var list3 = new List{5, 6, 7, 8};Use the union method to get the union of list1 and list2 −var res1 = list1.Union(list2); var res2 = res1.Union(list3);The following is ... Read More

Union Method in C#

Arjun Thakur

Arjun Thakur

Updated on 22-Jun-2020 12:59:22

552 Views

The Union method gets the unique elements from both the lists.Let us set two lists −var list1 = new List{12, 65, 88, 45}; var list2 = new List{40, 34, 65};Now get the union of both the lists −var res = list1.Union(list2);The following is the example −Example Live Demousing System.Collections.Generic; using System.Linq; ... Read More

What are the prerequisites before starting writing and using MySQL views?

Arjun Thakur

Arjun Thakur

Updated on 22-Jun-2020 12:56:03

165 Views

MySQL VersionAs we know that MySQL 5 introduced views, hence, first of all, we need to check for the version of MySQL before starting writing and using stored procedures. It can be done with the following query −mysql> Select VERSION(); +-----------+ | VERSION() | +-----------+ | 5.7.20    | +-----------+ ... Read More

Advertisements