Chandu yadav has Published 1091 Articles

What are the C++ features missing in C#?

Chandu yadav

Chandu yadav

Updated on 20-Jun-2020 16:12:29

240 Views

C# is a simple, modern, general-purpose, object-oriented programming language developed by Microsoft within its .NET initiative led by Anders Hejlsberg.C++ is a middle-level programming language developed by Bjarne Stroustrup starting in 1979 at Bell Labs. C++ runs on a variety of platforms, such as Windows, Mac OS, and the various ... Read More

Trigonometric Functions in C#

Chandu yadav

Chandu yadav

Updated on 20-Jun-2020 16:10:23

3K+ Views

Trignometric Functions in C# include, ACos, ASin, Sin, Cos, Tan, etc. It comes under the Math type of the System namespace.The following is an example showing how to implement trigonometric functions in C# −Example Live Demousing System; class Program {    static void Main() {       Console.WriteLine(Math.Acos(0));   ... Read More

How to delete/remove an element from a C# array?

Chandu yadav

Chandu yadav

Updated on 20-Jun-2020 16:06:09

11K+ Views

To delete an elements from a C# array, we will shift the elements from the position the user want the element to delete.Here, first we have 5 elements −int[] arr = new int[5] {35, 50, 55, 77, 98};Now let’s say we need to delete the element at 2nd position i.e. ... Read More

Time Functions in C#

Chandu yadav

Chandu yadav

Updated on 20-Jun-2020 16:02:46

983 Views

The DateTime has methods and properties for Date and Time as well like how to get the number of hours or minutes of a day, etc.Let us only focus on the time functions −Refer MSDN (Microsoft Developer Network) for all the functions −Sr.No.Method & Properties1AddDays(Double)Returns a new DateTime that adds ... Read More

What is a parameterized constructor in C# programs?

Chandu yadav

Chandu yadav

Updated on 20-Jun-2020 15:52:22

3K+ Views

In a constructor you can also add parameters. Such constructors are called parameterized constructors. This technique helps you to assign initial value to an object at the time of its creation.The following is an example −// class class DemoParameterized constructor with a prarameter rank −public Demo(int rank) { Console.WriteLine("RANK = ... Read More

What are the different access specifiers in C#.NET?

Chandu yadav

Chandu yadav

Updated on 20-Jun-2020 15:27:58

5K+ Views

The following are the access specifiers supported by C#.NET −Public Access SpecifierIt allows a class to expose its member variables and member functions to other functions and objects.Private Access SpecifierPrivate access specifier allows a class to hide its member variables and member functions from other functions and objects. Only functions ... Read More

What does the interface ICloneable do in C#?

Chandu yadav

Chandu yadav

Updated on 20-Jun-2020 15:22:00

2K+ Views

The ICloneable interface creates a copy of the exisiting object i.e a clone.It only has a single method −Clone() − The clone() method creates a new object that is a copy of the current instance.The following is an example showing how to perform cloning using Icloneable interface −Example Live Demousing System; ... Read More

How to destroy threads in C#?

Chandu yadav

Chandu yadav

Updated on 20-Jun-2020 15:12:48

811 Views

The Abort() method is used for destroying threads.The runtime aborts the thread by throwing a ThreadAbortException. This exception cannot be caught, the control is sent to the finally block, if any.The following is an example showing how to destroy threads −Example Live Demousing System; using System.Threading; namespace MultithreadingApplication {    class ThreadCreationProgram ... Read More

How to declare a tuple in C#?

Chandu yadav

Chandu yadav

Updated on 20-Jun-2020 14:57:34

484 Views

To declare a tuple the following is the format wherein we have a tuple with int and string items −Tuple tuple = new Tuple(20, "Tom");Now, check for first item in the tuple, which is an integer −if (tuple.Item1 == 99) {    Console.WriteLine(tuple.Item1); }Now check for second item in the ... Read More

IS vs AS Operators in C#

Chandu yadav

Chandu yadav

Updated on 20-Jun-2020 14:51:34

1K+ Views

IS operatorThe "is" operator in C# checks whether the run-time type of an object is compatible with a given type or not.The following is the syntax −expr is typeHere, expr is the expressiontype is the name of the typeThe following is an example showing the usage of is operator in ... Read More

Advertisements