C# program to replace n-th character from a given index in a string

Arjun Thakur
Published on 17-Sep-2018 15:36:44
Firstly, set a string.string str1 = "Port"; Console.WriteLine("Original String: "+str1);Now convert the string into character array.char[] ch = str1.ToCharArray();Set the character you want to replace with the index of the location. To set a character at position 3rd.ch[2] = 'F';To remove nth character from a string, try the following C# ... Read More

Covariance and Contravariance in C#

karthikeya Boyini
Published on 17-Sep-2018 15:36:17
To deal with classes effectively, use the concept of covariance and contra variance. Let us consider the following as our class. One is a base class for class Two, whereas Two is a base class for Three. class One { } class Two: One { } class Three ... Read More

Decimal Functions in C#

Chandu yadav
Published on 17-Sep-2018 15:33:35
The following are some of the decimal functions in C#.Sr.No.Name & Description1Add (Decimal, Decimal)Adds two specified Decimal values.2Ceiling(Decimal)Returns the smallest integral value that is greater than or equal to the specified decimal number.3Compare (Decimal, Decimal)Compares two specified Decimal values.4CompareTo(Decimal)Compares this instance to a specified Decimal object and returns a comparison of their relative values.5CompareTo(Object)Compares this instance ... Read More

Cohesion in C#

Samual Sam
Published on 17-Sep-2018 15:33:35
Cohesion in C# shows the relationship within modules. It shows the functional strength of the modules. The greater the cohesion, the better will be the program design. It is the dependency between the modules internal elements like methods and internal modules. High cohesion will allow you to reuse classes and ... Read More

Coupling in C#

George John
Published on 17-Sep-2018 12:44:54
Coupling shows the relationship between modules in C# or you can say the interdependence between modules.There are two types of coupling i.e tight and loose coupling.Loose CouplingLoose coupling is preferred since through it changing one class will not affect another class. It reduces dependencies on a class. That would mean ... Read More

Database Operations in C#

Samual Sam
Published on 17-Sep-2018 12:44:22
The most common databases used in C# are Microsoft SQL Server and Oracle. The following is done to work with databases. Connect Set the Database Name, Optional Parameters and Credentials. The username and password is needed to set a connection to the database. The connection string would look somewhat like ... Read More

Counters in C#

Ankith Reddy
Published on 17-Sep-2018 12:41:05
Counters in C# are performance counters that lets you know about your applications performance. When you will build an application, whether it is a web app, mobile app or even desktop app, you would definitely need to monitor the performance. For performance counters in C#, use the System.Diagnostics.PerformanceCounter class. Set ... Read More

Date Class in C#

karthikeya Boyini
Published on 17-Sep-2018 12:41:12
To set dates in C#, use DateTime class. The DateTime value is between 12:00:00 midnight, January 1, 0001 to 11:59:59 P.M., December 31, 9999 A.D.Let’s create a DateTime object.Example Live Demousing System; class Test {    static void Main() {       DateTime dt = new DateTime(2018, 7, 24);   ... Read More

Events vs Delegates in C#

Arjun Thakur
Published on 17-Sep-2018 12:37:54
C# events are used to resolve the hassles in Delegates. One an easily override Delegate properties and that can eventually lead to errors in the code. To avoid this, C# uses Events and defines wrappers around Delegates. Events in C# To use Event, you should define delegate first. Event is ... Read More

Enqueue and deque in Queue class in C#

karthikeya Boyini
Published on 17-Sep-2018 12:37:39
Queue collection class is a concept in C# that is included in the System.Collection namespace. The elements are stored in a QUEUE in FIFO. The first element added will be the first to go out like a queue of people outside a movie hall to buy tickets. It has two ... Read More