Karthikeya Boyini has Published 2383 Articles

How do we use enum keyword to define a variable type in C#?

karthikeya Boyini

karthikeya Boyini

Updated on 23-Jun-2020 14:29:11

68 Views

C# enumerations are value data type. An enumeration is a set of named integer constants. An enumerated type is declared using the enum keyword.The following is the syntax of enum.enum {    enumeration list };Let us see an example.enum Vehicle { Car, Bus, Truck };The following is an example ... Read More

How to split a string into elements of a string array in C#?

karthikeya Boyini

karthikeya Boyini

Updated on 23-Jun-2020 14:25:16

1K+ Views

Set the string you want to split.string str = "Hello World!";Use the split() method to split the string into separate elements.string[] res = str.Split(' ');The following is the complete code to split a string into elements of a string array in C#.Example Live Demousing System; class Demo {    static void ... Read More

How to use the Reverse() method of array class in C#

karthikeya Boyini

karthikeya Boyini

Updated on 23-Jun-2020 14:18:57

7K+ Views

The Reverse() method in array class reverses the sequence of the elements in the entire one-dimensional Array.To reverse an array, just use the Array.Reverse() method −Array.Reverse(temp);Within the reverse method, set the elements like the following code snippet.int[] list = { 29, 15, 30, 98}; int[] temp = list;You can try ... Read More

How to use the Compare method of the string class in C#?

karthikeya Boyini

karthikeya Boyini

Updated on 23-Jun-2020 14:16:04

176 Views

The Compare method compares two specified string objects and returns an integer that indicates their relative position in the sort order.Firstly, set the strings.string str1 = "Jack"; string str2 = "Mac";Now compare the strings using the Compare() method and if the comparison results 0, then it would mean the strings ... Read More

What to do with content that renders outside the element box with JavaScript?

karthikeya Boyini

karthikeya Boyini

Updated on 23-Jun-2020 13:35:09

191 Views

If the content renders outside the element box, use the overflow property to add a scroll. This will ease visitors in reading the entire content.ExampleYou can try to run the following code to learn how to work with overflow property in JavaScript −Live Demo           ... Read More

How to set the bottom margin of an element with JavaScript?

karthikeya Boyini

karthikeya Boyini

Updated on 23-Jun-2020 13:18:11

513 Views

Use the marginBottom property in JavaScript, to set the bottom margin.ExampleYou can try to run the following code to set the bottom margin of an element with JavaScript −Live Demo           This is demo text.       Set bottom margin                function display() {             document.getElementById("myID").style.marginBottom = "95px";          }          

How to set the boldness of the font with JavaScript?

karthikeya Boyini

karthikeya Boyini

Updated on 23-Jun-2020 13:07:11

82 Views

Use the fontWeight property in JavaScript to set the font boldness.ExampleYou can try to run the following code to set the boldness of the font with JavaScript −Live Demo           Heading 1                This is Demo Text.   ... Read More

How to use the GetType method of array class in C#?

karthikeya Boyini

karthikeya Boyini

Updated on 23-Jun-2020 12:45:29

2K+ Views

The GetType() method of array class in C# gets the Type of the current instance (Inherited from Object).To get the type.Type tp = value.GetType();In the below example, we are checking the int value using the type.if (tp.Equals(typeof(int))) Console.WriteLine("{0} is an integer data type.", value)The following is the usage of GetType() ... Read More

How to use the IndexOf(,) method of array class in C#?

karthikeya Boyini

karthikeya Boyini

Updated on 23-Jun-2020 12:41:47

10K+ Views

The IndexOf() method of array class in C# searches for the specified object and returns the index of the first occurrence within the entire one-dimensional Array.We have set the array.int[] arr = new int[10]; arr[0] = 100; arr[1] = 200; arr[2] = 300; arr[3] = 400; arr[4] = 500; arr[5] ... Read More

How to sort one dimensional array in descending order using Array Class method?

karthikeya Boyini

karthikeya Boyini

Updated on 23-Jun-2020 12:38:54

195 Views

The following is the unsorted array.int[] list = {98, 23, 97, 36, 77};Now first use the Sort() method to sort the array.Array.Reverse(list);Use the Reverse() method that would eventually give you a sorted array in descending order.Array.Reverse(list);You can try to run the following code to to sort one dimensional array in ... Read More

Advertisements