Karthikeya Boyini has Published 2193 Articles

How to set the boldness of the font with JavaScript?

karthikeya Boyini

karthikeya Boyini

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

141 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

3K+ 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

14K+ 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

249 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

How to create or reset counters with JavaScript?

karthikeya Boyini

karthikeya Boyini

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

878 Views

To create counters, use the counterReset property in JavaScript. You can try to run the following code to create or reset one or more counters with JavaScript −ExampleLive Demo                    h2:before {             counter-increment: section; ... Read More

What are abstract classes in C#?

karthikeya Boyini

karthikeya Boyini

Updated on 23-Jun-2020 12:23:37

392 Views

Abstract classes contain abstract methods, which are implemented by the derived class. The derived classes have more specialized functionality.The following is an example showing the usage of abstract classes in C#.Example Live Demousing System; namespace Demo {    abstract class Shape {       public abstract int area();    } ... Read More

What are Add, Remove methods in C# lists?

karthikeya Boyini

karthikeya Boyini

Updated on 23-Jun-2020 12:17:39

1K+ Views

The List is a collection in C# and is a generic collection. The add and remove methods are used in C# lists for adding and removing elements.Let us see how to use Add() method in C#.Example Live Demousing System; using System.Collections.Generic; class Program {    static void Main() {     ... Read More

How to create a tuple with string and int items in C#?

karthikeya Boyini

karthikeya Boyini

Updated on 23-Jun-2020 12:11:10

410 Views

Firstly, set two items in the tuple.Tuple tuple = new Tuple(20, "Tom");Now check for first item in the tuple, which is an integer.if (tuple.Item1 == 20) {    Console.WriteLine(tuple.Item1); }Now check for second item in the tuple, which is a string −if (tuple.Item2 == "Tom") {    Console.WriteLine(tuple.Item2); }The following ... Read More

How to create custom attributes in C#?

karthikeya Boyini

karthikeya Boyini

Updated on 23-Jun-2020 12:08:35

296 Views

Custom attributes that can be used to store declarative information and can be retrieved at run-time.Let us see how to declare custom attribute.[AttributeUsage ( AttributeTargets.Class | AttributeTargets.Constructor | AttributeTargets.Field | AttributeTargets.Method | AttributeTargets.Property, AllowMultiple = true)] public class DeBugInfo : System.AttributeFor our example, let us construct a custom attribute named ... Read More

What is the scope resolution operator in C#?

karthikeya Boyini

karthikeya Boyini

Updated on 23-Jun-2020 11:50:48

1K+ Views

The scope resolution operator in C# has a different meaning as compared with C++. In C++ the :: is used for global variables, whereas in C# it is related to namespaces.If you have a type that share an identifier in different namespace, then to identify them use the scope resolution ... Read More

Advertisements