Arjun Thakur has Published 1025 Articles

What is difference between internal and private modifiers in C#?

Arjun Thakur

Arjun Thakur

Updated on 21-Jun-2020 15:02:21

2K+ Views

Internal Access SpecifierInternal access specifier allows a class to expose its member variables and member functions to other functions and objects in the current assembly.Any member with internal access specifier can be accessed from any class or method defined within the application in which the member is defined.The following is ... Read More

How to add items to a list in C#?

Arjun Thakur

Arjun Thakur

Updated on 21-Jun-2020 14:58:17

925 Views

Firstly, declare a list −var teams = new List();To add items to a C# list, use the Add() method −teams.Add("US"); teams.Add("Canada"); teams.Add("India"); teams.Add("Australia");You can try to run the following code to add items to a list in C# −Exampleusing System; using System.Collections.Generic; public class Demo {    public static ... Read More

Variable Arguments (Varargs) in C#

Arjun Thakur

Arjun Thakur

Updated on 21-Jun-2020 13:59:58

6K+ Views

Use the param keyword to get the variable arguments in C#.Let us see an example to multiply integers. We have used params keyword to accept any number of int values −static int Multiply(params int[] b)The above allows us to find multiplication of numbers with one as well as two int ... Read More

How to convert a Decimal to Octal using C#?

Arjun Thakur

Arjun Thakur

Updated on 21-Jun-2020 13:43:30

402 Views

To get the octal equivalent, use a while loop for the decimal value and store the remainder in the array set for octal. Here we have set the remainder by mod 8 in the array.Then divide the number by 8 −while (dec != 0) {    oct[i] = dec % ... Read More

How command line arguments are passed in main method in C#?

Arjun Thakur

Arjun Thakur

Updated on 21-Jun-2020 13:31:42

346 Views

The Main() method is the entry point −static void Main(string[] args)The arguments array args is used to set arguments −string[] args)It will set the following if you add two arguments −var args = new string[] {"arg1", "arg2”}Here is the demo code −Exampleusing System; namespace Demo {    class HelloWorld ... Read More

How to access elements from multi-dimensional array in C#?

Arjun Thakur

Arjun Thakur

Updated on 21-Jun-2020 12:54:49

306 Views

To acess element from the multi-dimensional array, just add the index for the element you want, for example −a[2, 1]The above access element from 3rd row and 2nd column ie element 3 as shown below in out [3, 4] array −0 0 1 2 2 4 3 6Let us see ... Read More

What is a recursive method call in C#?

Arjun Thakur

Arjun Thakur

Updated on 21-Jun-2020 12:49:30

394 Views

Recursive method call in C# is called Recursion. Let us see an example to calculate power of a number using recursion.Here, if the power is not equal to 0, then the function call occurs which is eventually recursion −if (p!=0) {    return (n * power(n, p - 1)); }Above, ... Read More

List down a list of the escape characters in C#

Arjun Thakur

Arjun Thakur

Updated on 21-Jun-2020 12:34:14

1K+ Views

The following is the list of escape characters in C# −Escape characterDescriptionPattern\aMatches a bell character, \u0007.\a\bIn a character class, matches a backspace, \u0008.[\b]{3, }\tMatches a tab, \u0009.(\w+)\t\rMatches a carriage return, \u000D. (\r is not equivalent to the newline character, .)\r(\w+)\vMatches a vertical tab, \u000B.[\v]{2, }\fMatches a form feed, \u000C.[\f]{2, }Matches ... Read More

What are the prerequisites for learning C#?

Arjun Thakur

Arjun Thakur

Updated on 21-Jun-2020 12:27:50

579 Views

To start learning C#, firstly you should have computer knowledge. With that, if you have a prior learning experience in C or C#, then it would be great.To start with C#, first install Visual Studio. The current version is Visual Studio 2017.If you want to avoid the hassles of installing ... Read More

3D transforms in CSS3

Arjun Thakur

Arjun Thakur

Updated on 21-Jun-2020 08:32:01

87 Views

Using with 3d transforms, we can move element to x-axis, y-axis and z-axis.ExampleThe following an example shows the x-axis 3D transformsLive Demo                    div {             width: 200px;             height: 100px; ... Read More

Advertisements