Samual Sam has Published 2492 Articles

How to use the return statement in C#?

Samual Sam

Samual Sam

Updated on 23-Jun-2020 12:40:43

499 Views

The return statement is used to return value. When a program calls a function, the program control is transferred to the called function. A called function performs a defined task and when its return statement is executed or when its function-ending closing brace is reached, it returns the program control ... Read More

How to use the ?: conditional operator in C#?

Samual Sam

Samual Sam

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

244 Views

A conditional operator is represented by the symbol '?:' The first operand is the evaluating expression. It has right to left associativity.The syntax for conditional operator.expression ? expression : expressionThe conditional operator works as follows −The first operand is implicitly converted to bool.If the first operand evaluates to true, the ... Read More

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

Samual Sam

Samual Sam

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

2K+ Views

The CopyTo() method in C# is used to copy elements of one array to another array. In this method, you can set the starting index from where you want to copy from the source array.The following is the syntax.CopyTo(dest, index);Here dest = destination arrayindex= starting indexThe following is an example ... Read More

How to sort an ArrayList in C#?

Samual Sam

Samual Sam

Updated on 23-Jun-2020 12:32:40

2K+ Views

To sort an ArrayList in C#, use the Sort() method.The following is the ArrayList.ArrayList arr = new ArrayList(); arr.Add(32); arr.Add(12); arr.Add(55); arr.Add(8); arr.Add(13);Now the Sort() method is used to sort the ArrayList.arr.Sort();You can try to run the following code to sort an ArrayList in C#.Example Live Demousing System; using System.Collections; namespace ... Read More

What are the differences between public, protected and private access specifiers in C#?

Samual Sam

Samual Sam

Updated on 23-Jun-2020 12:20:52

2K+ Views

Public Access SpecifierPublic access specifier allows a class to expose its member variables and member functions to other functions and objects. Any public member can be accessed from outside the class.Example Live Demousing System; namespace Demo {    class Rectangle {       public double length;       public ... Read More

How to set an element's display type with JavaScript?

Samual Sam

Samual Sam

Updated on 23-Jun-2020 12:20:01

1K+ Views

To set an element’s display type, use the display property. If you want to hide the element, then use none.ExampleYou can try to run the following code to set an element's display type with JavaScript −Live Demo                    #myID { ... Read More

How to create arrays dynamically in C#?

Samual Sam

Samual Sam

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

4K+ Views

Dynamic arrays are growable arrays and have an advantage over static arrays. This is because the size of an array is fixed.To create arrays dynamically in C#, use the ArrayList collection. It represents ordered collection of an object that can be indexed individually. It also allows dynamic memory allocation, adding, ... Read More

How to set the column rule properties with JavaScript?

Samual Sam

Samual Sam

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

123 Views

The columnRule property is used in JavaScript to set the column rule. It allows you to set the style, color, and width between column rule.ExampleYou can try to run the following code to set the column rule properties with JavaScript −Live Demo           Click below ... Read More

How to create user defined exceptions in C#?

Samual Sam

Samual Sam

Updated on 23-Jun-2020 12:07:05

235 Views

Like any other programming language, in C#, you can easily create user-defined exception. User-defined exception classes are derived from the Exception class.In the below example, the exception created is not a built-in exception.TempIsZeroExceptionYou can try to run the following code to learn how to create user defined exception in C#.Example Live ... Read More

What is the IsFixedSize property of ArrayList class in C#?

Samual Sam

Samual Sam

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

92 Views

The IsFixedSize property of ArrayList class is used to get a value indicating whether the ArrayList has a fixed size.The following is an example stating the usage of isFixedSize property.Example Live Demousing System; using System.Collections; class Demo {    public static void Main() {       ArrayList arrList = new ... Read More

Advertisements