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 2510 of 2650
500 Views
A class definition starts with the keyword class followed by the class name; and the class body enclosed by a pair of curly braces.The following is the syntax − class class_name { // member variables variable1; variable2; ... variableN; // member methods method1(parameter_list) { // method body } method2(parameter_list) { // method body } ... methodN(parameter_list) { // method body } }The following are the conventions ... Read More
602 Views
To start learning C#, firstly you should have computer knowledge. With that, if you have a prior learning experience in C or C#, then it would be great.To start with C#, first install Visual Studio. The current version is Visual Studio 2017.If you want to avoid the hassles of installing a bulky Visual Studio IDE, then you can begin with Online Compilers. The top online compilers to run C# programs are −Coding groundDotNetFiddleBoth of the above are intelligent compilers. Just go there, type the C# code and run it. That’s it!
1K+ Views
System.Array implements interfaces, like ICloneable, IList, ICollection, and IEnumerable, etc. The ICloneable interface creates a copy of the existing object i.e a clone.Let us see learn about the ICloneable interface. It only has a Clone() methods because it 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 −Exampleusing System; class Car : ICloneable { int width; public Car(int width) { this.width = width; } public object Clone() { return new Car(this.width); ... Read More
406 Views
The following are the hidden or lesser known useful features of C# −Lambda ExpressionsA lambda expression in C# describes a pattern. It has the token => in an expression context. This is called goes to operator and used when a lambda expression is declared.NullablesC# provides a special data types, the nullable types, to which you can assign normal range of values as well as null values. The following is the syntax − ? = null;Null Coalescing OperatorThe null coalescing operator is used with the nullable value types and reference types. It is used for converting an operand to the ... Read More
187 Views
The following is an example showing how to display some of the escape characters in C# −Exampleusing System; using System.Collections.Generic; class Demo { static void Main() { Console.WriteLine("Warning!" + '\u0007'); Console.WriteLine("Test \t Demo Text"); Console.WriteLine("This is it!This is on the next line!"); } }For the complete list of escape sequences in C# −Escape characterDescriptionPattern\aMatches a bell character, \u0007.\a\bIn a character class, matches a backspace, \u0008.[\b]{3, }\tMatches a tab, \u0009.(\w+)\t\rMatches a carriage return, \u000D. (\r is not equivalent to the newline character, .)\r(\w+)\vMatches a vertical tab, ... Read More
2K+ Views
Type safe in C# wouldn’t allow an object to sneak into other object’s memory. Let us see an example to understand the concept of −Examplepublic class One { public int Prop{ get; set;} } public class Two { public int Prop{get;set;} public int Prop1{get;set;} }Let’s say I have an object Class One −One ob = new One();Now you won’t be able to cast your object ob to the second class i.e. class Two. If you will cast it then a compile time error will arise because of the Type Safe feature in C#.
3K+ Views
Transpose of a matrix flips the matrix over its diagonal and this brings the row elements on the column and column elements on the row.For example −Matrix before Transpose: 123 456 789 Matrix after Transpose: 147 258 369Let us see an example in C# to achieve transpose of a matrix −Exampleusing System; public class Demo { public static void Main() { int i, j, m, n; int[, ] arr1 = new int[30, 30]; int[, ] arr2 = new int[30, 30]; Console.Write("Enter the number of ... Read More
210 Views
To get the octal equivalent of a decimal in C# −Firstly, for the decimal value use a while loop and store the remainder in the array set for octal. Here we found the mod 8 of them in the array.After that, divide the number by 8 −while (dec != 0) { oct[i] = dec % 8; dec = dec / 8; i++; }Let us see the complete code. Here, our decimal number is 12 −Exampleusing System; namespace Demo { class Program { static void Main(string[] args) { ... Read More
2K+ Views
A static array is a data structure with a fixed size. Let us see an example of a static array in C#.Here is a static string array. The data remains the same here i.e. fixed −static string[] _fruits = new string[] { "apple", "mango" };Now let us see the complete example to create and access static arrays in C# −Exampleusing System; class Demo { static void Main() { foreach (string fruits in Program.Fruits) { Console.WriteLine(fruits); } } } public static class Program { static string[] _fruits = new string[] { "apple", "mango" }; public static string[] Fruits { get { return _fruits; } } }
487 Views
When you use sealed modifiers in C# on a method, then the method loses its capabilities of overriding. The sealed method should be part of a derived class and the method must be an overridden method.Let us see an example −The following example won’t allow you to override the method display() because it has a sealed modifier for the ClassTwo derived class −ClassOne is our base class, whereas ClassTwo and ClassThree are derived classes −Exampleclass ClassOne { public virtual void display() { Console.WriteLine("baseclass"); } } class ClassTwo : ClassOne { public sealed override ... Read More