Chandu yadav

Chandu yadav

810 Articles Published

Articles by Chandu yadav

Page 32 of 81

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

Chandu yadav
Chandu yadav
Updated on 20-Jun-2020 277 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 versions of UNIX.The following are some of the features of C++ missing in C# −In C#, Multiple Inheritance is not possible, whereas C++ can easily implement Multiple Inheritance.In C++, you need to manage memory manually and must allocate and deallocate memory for your objects.C++ can create standalone applications, whereas C# ...

Read More

Trigonometric Functions in C#

Chandu yadav
Chandu yadav
Updated on 20-Jun-2020 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));       Console.WriteLine(Math.Cos(2));       Console.WriteLine(Math.Asin(0.2));       Console.WriteLine(Math.Sin(2));       Console.WriteLine(Math.Atan(-5));       Console.WriteLine(Math.Tan(1));    } }Output1.5707963267949 -0.416146836547142 0.201357920790331 0.909297426825682 -1.37340076694502 1.5574077246549Above we saw the Inverse Sine value using Asin −Math.Asin(0.2)With that, we also saw the Inverse Cosine value using Acos −Math.Acos(0)In the ...

Read More

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

Chandu yadav
Chandu yadav
Updated on 20-Jun-2020 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. variable “pos = 2” is set, for that shift the elements after the specified position −// Shifting elements for (i = pos-1; i < 4; i++) {    arr[i] = arr[i + 1]; }Now display the result as shown in the complete code below.Example Live Demousing System; using System.Collections.Generic; using System.Linq; ...

Read More

Time Functions in C#

Chandu yadav
Chandu yadav
Updated on 20-Jun-2020 1K+ 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 the specified number of days to the value of this instance.2AddHours(Double)Returns a new DateTime that adds the specified number of hours to the value of this instance.3AddMilliseconds(Double)Returns a new DateTime that adds the specified number of milliseconds to the value of this instance.4AddMinutes(Double)Returns a new DateTime that adds the specified ...

Read More

What is a parameterized constructor in C# programs?

Chandu yadav
Chandu yadav
Updated on 20-Jun-2020 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 = {0}", rank); }Here is the complete example displaying how to work with parameterized constructor in C# −Example Live Demousing System; namespace Demo {    class Line {       private double length; // Length of a line             public Line(double len) { //Parameterized constructor ...

Read More

What does the interface ICloneable do in C#?

Chandu yadav
Chandu yadav
Updated on 20-Jun-2020 3K+ 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; class Car : ICloneable {    int width;    public Car(int width) {       this.width = width;    }    public object Clone() {       return new Car(this.width);    }    public override string ToString() {       return string.Format("Width of ...

Read More

How to declare a tuple in C#?

Chandu yadav
Chandu yadav
Updated on 20-Jun-2020 526 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 tuple, which is a string − if (tuple.Item2 == "Tim") {    Console.WriteLine(tuple.Item2); }The following is an example to create a tuple with string and int items −using System; using System.Threading; namespace Demo {    class Program {       static void Main(string[] args) {   ...

Read More

IS vs AS Operators in C#

Chandu yadav
Chandu yadav
Updated on 20-Jun-2020 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 C# &minis;Example Live Demousing System; class One { } class Two { } public class Demo {    public static void Test(object obj) {       One x;       Two y;       if (obj is One) {          Console.WriteLine("Class One"); ...

Read More

Transform the element along with x-axis and y-axis with CSS

Chandu yadav
Chandu yadav
Updated on 20-Jun-2020 2K+ Views

Use the translate(x,y) method to transform the element along with x-axis and y-axis.Let us see the syntaxtranslate(x,y)Here, x is a length representing the x-coordinate of the translating vector.y is a length representing the ordinate of the translating vectorLet us see an examplediv {    width: 50px;    height: 50px;    background-color: orange; } .trans {    transform: translate(20px);    background-color: black; }

Read More

What is garbage collection in C#?

Chandu yadav
Chandu yadav
Updated on 20-Jun-2020 9K+ Views

The garbage collector (GC) manages the allocation and release of memory. The garbage collector serves as an automatic memory manager.You do not need to know how to allocate and release memory or manage the lifetime of the objects that use that memory.An allocation is made any time you declare an object with a “new” keyword or a value type is boxed. Allocations are typically very fast.When there isn’t enough memory to allocate an object, the GC must collect and dispose of garbage memory to make memory available for new allocations.This process is known as garbage collection.Garbage Collection in C# has ...

Read More
Showing 311–320 of 810 articles
« Prev 1 30 31 32 33 34 81 Next »
Advertisements