Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Server Side Programming Articles - Page 2420 of 2646
2K+ Views
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# code. Here, we are replacing the first character.Example Live Demousing System; using System.Collections.Generic; public class Demo { public static void Main(string[] args) { string str1 = "Port"; Console.WriteLine("Original String: "+str1); char[] ch = str1.ToCharArray(); ch[0] = 'F'; ... Read More
2K+ Views
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 method. An example of High cohesion can be seen in System.Math class i.e.it has Mathematical constants and static methods − Math.Abs Math.PI Math.Pow A class that does a lot of things at a time is hard to understand and maintain. This is what we call low cohesion and ... Read More
284 Views
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 to a specified object and returns a comparison of their relative values.6Divide (Decimal, Decimal)Divides two specified Decimal values.7Equals(Decimal)Returns a value indicating whether this instance and a specified Decimal object represent the same value.Let us see an example of Decimal Ceiling() method in C# that returns the smallest integral value greater than or equal to ... Read More
3K+ Views
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 you can easily reuse it.Writing loosely coupled code has the following advantages −One module won’t break other modulesEnhances testabilityCode is easier to maintainGets less affected by changes in other components.Tight CouplingIn Tight Coupling, the classes and objects are dependent on each other and therefore reduce re-usability of code.Read More
2K+ Views
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 this. private static string _connectionString = "Data Source=.;Integrated Security=SSPI;Initial Catalog=test;Application Name=Demo;Connection Timeout2w00"; Above, the Application Name is Demo. Select Statement To fetch data from the database, the SELECT statement is used Insert The INSERT command is used to insert data in the database. Update The database ... Read More
2K+ Views
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 the instance of the PerformanceCounter class and work with the following properties: CategoryName, CounterName, MachineName and ReadOnly. To get the performance categories. var counter = PerformanceCounterCategory.GetCategories(); Now SET performance counters for the category processor. var counter = PerformanceCounterCategory.GetCategories() .FirstOrDefault(category => category.CategoryName == "Processor");
14K+ Views
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); Console.WriteLine (dt.ToString()); } }Output7/24/2018 12:00:00 AMLet us now get the current date and time.Example Live Demousing System; class Test { static void Main() { Console.WriteLine (DateTime.Now.ToString()); } }Output9/17/2018 5:49:21 AMNow using the method Add(), we will add days in a date with the ... Read More
568 Views
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 a type of Delegate and an example of event can be when a key is pressed. public delegate voide Demo(String val); public event Test TestEvent; An event can hold a delegate like this. this.TestEvent += new Demo (DemoData); ... Read More
969 Views
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 methods. Enqueue() method to add values Dequeue() method to retrieve values Enqueue Add items in the queue. Queue q = new Queue(); q.Enqueue(“Two”); q.Enqueue(“One”); Dequeue Return items from the queue. Queue q = new Queue(); q.Enqueue(“Two”); q.Enqueue(“One”); // remove elements while (q.Count > 0) ... Read More
8K+ Views
For super keyword in Java, we have the base keyword in C#.Super keyword in Java refers immediate parent class instance. It is used to differentiate the members of superclass from the members of subclass, if they have same names. It is used to invoke the superclass constructor from subclass.C# base keyword is used to access the constructors and methods of base class. Use it within instance method, constructor, etc.Let us see an example of C# base.Example Live Demousing System; public class Animal { public string repColor = "brown"; } public class Reptile: Animal { string repColor = "green"; ... Read More