- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 35163 Articles for Programming
253 Views
Bitwise operator works on bits and performs bit by bit operation.The following are the Bitwise operators.OperatorDescriptionExample&Binary AND Operator copies a bit to the result if it exists in both operands.(A & B) = 12, which is 0000 1100|Binary OR Operator copies a bit if it exists in either operand.(A | B) = 61, which is 0011 1101^Binary XOR Operator copies the bit if it is set in one operand but not both.(A ^ B) = 49, which is 0011 0001~Binary Ones Complement Operator is unary and has the effect of 'flipping' bits.(~A ) = 61, which is 1100 0011 in ... Read More
172 Views
A class can be derived from more than one class or interface, which means that it can inherit data and functions from multiple base classes or interfaces.For example, Vehicle Base class with the following Derived Classes.Truck Bus MotobikeThe derived class inherits the base class member variables and member methods.In the same way, the derived class for Shape class can be Rectangle as in the following example.Example Live Demousing System; namespace Program { class Shape { public void setWidth(int w) { width = w; } public void setHeight(int ... Read More
141 Views
An attribute is a declarative tag that is used to convey information to runtime about the behaviours of various elements like classes, methods, structures, enumerators, assemblies etc. in your program. The following is the syntax. [attribute(positional_parameters, name_parameter = value, ...)] Element Here, Name of the attribute and its values are specified within the square brackets, before the element to which the attribute is applied. Positional parameters specify the essential information and the name parameters specify the optional information. The following are the predefined attributes in C#. AttributeUsage The pre-defined attribute AttributeUsage describes how a custom attribute class ... Read More
170 Views
An operator is a symbol that tells the compiler to perform specific mathematical or logical manipulations.OperatorDescriptionExample+Adds two operandsA + B = 30-Subtracts second operand from the firstA - B = -10*Multiplies both operandsA * B = 200/Divides numerator by de-numeratorB / A = 2%Modulus Operator and remainder of after an integer divisionB % A = 0++Increment operator increases integer value by oneA++ = 11--Decrement operator decreases integer value by oneA-- = 9Let us see an example to use arithmetic operators in C#.Example Live Demousing System; namespace Demo { class Program { static void Main(string[] args) { ... Read More
88 Views
Anonymous methods are the methods without a name. These methods provide a technique to pass a code block as a delegate parameter.Anonymous methods are declared with the creation of the delegate instance, with a delegate keyword.Example Live Demousing System; delegate void Demo(int n); namespace DelegateAppl { class TestDelegate { static int num = 50; public static void AddNum(int p) { num += p; Console.WriteLine("Named Method: {0}", num); } public static void MultNum(int q) { num *= ... Read More
184 Views
Anchors are constructs in regular expressions in C#. It allows a match to succeed or fail depending on the current position in the string. The following table lists the anchors. Assertion Description Pattern Matches ^ The match must start at the beginning of the string or line ^\d{3} "567" in "567-777-" $ The match must occur at the end of the string or before at the end of the line or string. -\d{4}$ "-2012" in "8-12-2012" \A The match must occur at the start of the string. \A\w{3} "Code" in "Code-007-" ... Read More
2K+ Views
To sort an ArrayList in C#, use the Sort() method.The following is the ArrayList.ArrayList arr = new ArrayList(); arr.Add(32); arr.Add(12); arr.Add(55); arr.Add(8); arr.Add(13);Now the Sort() method is used to sort the ArrayList.arr.Sort();You can try to run the following code to sort an ArrayList in C#.Example Live Demousing System; using System.Collections; namespace Demo { class Program { static void Main(string[] args) { ArrayList arr = new ArrayList(); arr.Add(32); arr.Add(12); arr.Add(55); arr.Add(8); arr.Add(13); ... Read More
73 Views
Array can be initialized in more than one ways in C#. Let us see some example.Method OneUsing size of array.int [] marks = new int[5] { 99, 98, 92, 97, 95};Method TwoBy omitting the size.int [] marks = new int[] { 99, 98, 92, 97, 95};Method ThreeInitializing at the time of declaration.int [] marks = { 99, 98, 92, 97, 95};Let us see one of the ways to initialize arrays in C#.Example Live Demousing System; namespace Demo { class MyArray { static void Main(string[] args) { int [] n = new int[10]; /* ... Read More
630 Views
The List is a collection in C# and is a generic collection. The add and remove methods are used in C# lists for adding and removing elements.Let us see how to use Add() method in C#.Example Live Demousing System; using System.Collections.Generic; class Program { static void Main() { List sports = new List(); sports.Add("Football"); sports.Add("Tennis"); sports.Add("Soccer"); foreach (string s in sports) { Console.WriteLine(s); } } }OutputFootball Tennis SoccerLet us see how to use Remove() method in C#.Example Live ... Read More
580 Views
Properties are an extension of fields and are accessed using the same syntax. They use accessors through which the values of the private fields can be read, written or manipulated.The accessor of a property contains the executable statements that helps in getting (reading or computing) or setting (writing) the property.Let us see an example of properties in C#.ExampleDeclare a code property of type string.public string Code { get { return code; } set { code = value; } }In the same way, declare Age property of type as in the ... Read More
To Continue Learning Please Login
Login with Google