Hi readers, Today I am going to tell you about the advantages of C#. And Definitely, This article will help you to understand what C# is and advantages of C#. First of all, I will explain the advantages then you can read at the end of the article what is c#?
This is the list of top 10 advantages of C#.
- C# is different from java.
- C# Delegates
- C# Collections
- C# Exception handling
- File Handling in C#
- Future of C#
- Garbage Collection.
- No Problem if Memory Leak
- Cross Platform
- .Programming Support
1.Difference between C# and java
|S.No||C# programing language||Java programing language|
|Microsoft is the developer of C#.Anders Hejlsberg is the Founder of C#. C# contains more data types then javaAnd allow the extension to the value types.enumerations, type-safe value types are supported by the C#C# is supportable for operator overloadingYou can also create genuine rectangular arrays and they may be replaced of the jagged array.|
C# supports the concept of class properties.C# uses CLR for Compilation C.L.R. can abbreviate as common language runtime.
|Sun-Microsystem is the developer of Java.Java is founded by James gosling.Java can declare a class to emulate enumerations.|
While Java isn’t supportable.There is the concept of the jugged array and this jagged array can member of other arrays.and arrays can member of another array.Java doesn’t support it. While Java uses java virtual machine(JVM).
If we talk about delegates then we can say delegate is class Which is used to create at a runtime delegate, And it is one of the best types in .Net
In other programming languages like C and C++ used to a function pointer was in c#.similarly delegate in c# work like a function pointer, We can say delegate contains data as a delegate is a special type of object.
Need Of delegate
Sometimes a situation appears that we have to pass methods around to other methods. then we create a delegate for this purpose
It can encapsulate method into class and can be used in any context, it serves for the basis of event handling model in c#. but passing a method to another method through a delegate parameter.
Another way of understanding delegates is thinking of a delegate as something we are providing a name to a method signature.
Benefit of delegates
Delegate is a based on Oops concept and it’s secure and delegate helps with code optimization
There are many collections, such as ArrayList, Hashtable, queues, Dictionaries. abstractions of data algorithms are Collections. We can say An ArrayList as an abstract dynamic array, a Hashtable collection used to abstracts a lookup table, a Queues collection of an abstracts queues and so on. In addition to that, collections implement ICollection, IEnumerable and IClonable interfaces. The detailed specification for each collection
4.C# Exception handling
Microsoft.Net has an inbuilt Exception handling mechanism to know and handle run time errors. There are many Exception handling standards are available in MS.net. It detects exception while run time. And this error can be done by user or logic or system anomalies, it has by default mechanism that terminates the program execution.
C# provides 3 keywords for exception handling these are try-catch and finally. The try block used when any exception may throw.it will stop to that block and pass to the catch block whereas catch used to handle an exception if one exists. when doing any clean-up process finally can be used for that.
5.File Handling in C#
System library provides four categories that permit you to control individual files, further as the act with a machine directory structure. The Directory and File directly extend System. Object and supports the creation, copying, moving and deletion of files mistreatment varied static ways. They solely contain static ways and are ne’er instantiated. The FileInfo and DirectoryInfo sorts are derived from the abstract category FileSystemInfo kind and that they are generally utilized for getting the total details of a file or directory as a result of their members tend to come back powerfully written objects. They implement roughly constant public ways as a Directory and File however they’re stateful and also the members of those categories aren’t static.
6.Future of C#
Todays C# is a multitasking language here multitask means by using c# language we can develop windows application, Web application and android and don’t be a hurry you can also develop an IOS application. In 2016 event Microsoft has announced several exciting announcements and they announced that integrating Xamarin as a part of Visual studio. that’s why C# developers can develop android and IOS applications . So the future of The c# is very bright.
C# programming language’s best advantage is. It removes automatically garbage collection. And C# doesn’t make garbage.it removes all the garbage present in the system.so that when an application executes than
8.No Problem if Memory Leak
The best advantage of C# is a strong memory backup. There is no problem with the memory leak and any other problems in the C# as used to happen in case of the C++ language.
If your system has installed MS.net then your system runs well .MS.net is important for C#. And this is a good opportunity for young programmers to get them trained with NET software.
You can get support from Microsoft, but you have to buy it. (.NET framework) unlike Java where the community is your support. So if anything goes wrong in MS.net then you can get the support of Microsoft.