
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
Found 2587 Articles for Csharp

3K+ Views
As we know that exception is something that refers to the interruption in the flow of program or application. This unwanted event is known as Exception and is generally gives the indication regarding something wrong within the code. Basically particularly in language C# an exception can be a System or an Application Level exception. So on the basisSr. No.KeySystem level exceptionApplication level exception1DerivationSystem exceptions are derived from the base class System.SystemException which in itself is a derived class of SystemException.On other hand Application-level exceptions are derived from the base class System.ApplicationException which is again a derived class of SystemException2OccurrenceIn general ... Read More

3K+ Views
As we all know that C# is an object oriented programming just like Java and provides full support for object-oriented concepts that are Encapsulation, Abstraction, Inheritance, and Polymorphism. In contrast to Abstraction both Abstract class and Interface are coming out in picture as both of these provides abstraction in C# program.In an abstract class, we can create the functionality and that needs to be implemented by the derived class. The interface allows us to define the functionality or functions but cannot implement that. The derived class extend the interface and implement those functions.Following are the important differences between Abstract Class ... Read More

6K+ Views
As we know that programming in any language get starts with declaration a variable after which its definition and logic implementation take place. So it is one of the most important factors to know that how to declare variable in any programming language before starts coding in it.Now if we take an instance of C# language there is change in declaration in variable with the advancement in the language. As in former version of C# all the code written was validated at the compile time itself which made it as Static typed language where variables are getting declared using var ... Read More

112 Views
To get the total number of elements in a specified dimension of an array, the code is as follows −Example Live Demousing System; public class Demo { public static void Main() { string[] products = new string[] { "Andy", "Mark", "Gary", "Andre"}; Console.WriteLine("One or more name begins with 'A'? = {0}", Array.Exists(products, ele => ele.StartsWith("A"))); Console.WriteLine("Is the array having fixed size? = " + products.IsFixedSize); Console.WriteLine("Is the array read only? = " + products.IsReadOnly); Console.WriteLine("Is the array synchronized? = " + products.IsSynchronized); ... Read More

128 Views
To set the capacity to the actual number of elements in a SortedList object, the code is as follows −Example Live Demousing System; using System.Collections; public class Demo { public static void Main(String[] args) { SortedList sortedList = new SortedList(); sortedList.Add("A", "1"); sortedList.Add("B", "2"); sortedList.Add("C", "3"); sortedList.Add("D", "4"); sortedList.Add("E", "5"); sortedList.Add("F", "6"); sortedList.Add("G", "7"); sortedList.Add("H", "8"); sortedList.Add("I", "9"); sortedList.Add("J", "10"); Console.WriteLine("SortedList elements..."); ... Read More

118 Views
To set the capacity to the actual number of elements in the ArrayList, the code is as follows −Example Live Demousing System; using System.Collections; public class Demo { public static void Main(String[] args) { ArrayList list1 = new ArrayList(); list1.Add("A"); list1.Add("B"); list1.Add("C"); list1.Add("D"); list1.Add("E"); list1.Add("F"); list1.Add("G"); list1.Add("H"); list1.Add("I"); Console.WriteLine("Elements in ArrayList1..."); foreach (string res in list1) { Console.WriteLine(res); ... Read More

201 Views
To search for an element matching the conditions and return the zero-based index of the last occurrence within the entire List, the code is as follows −Example Live Demousing System; using System.Collections.Generic; public class Demo { private static bool demo(int i) { return ((i % 10) == 0); } public static void Main(String[] args) { List list = new List(); list.Add(200); list.Add(215); list.Add(310); list.Add(500); list.Add(600); Console.WriteLine("List elements..."); foreach (int i in ... Read More

155 Views
To search the index of specified object in Collection, the code is as follows −Example Live Demousing System; using System.Collections.Specialized; public class Demo { public static void Main() { StringCollection strCol = new StringCollection(); strCol.Add("Accessories"); strCol.Add("Books"); strCol.Add("Electronics"); strCol.Add("Books"); Console.WriteLine("StringCollection elements..."); foreach (string res in strCol) { Console.WriteLine(res); } strCol.Insert(2, "Headphone"); Console.WriteLine("StringCollection elements...UPDATED"); foreach (string res in strCol) { Console.WriteLine(res); ... Read More

95 Views
To get the number of elements contained in the BitArray, the code is as follows −Example Live Demousing System; using System.Collections; public class Demo { public static void Main() { BitArray arr1 = new BitArray(5); BitArray arr2 = new BitArray(5); arr1[0] = false; arr1[1] = false; arr2[0] = false; arr2[1] = true; Console.WriteLine("BitArray1 elements..."); foreach (bool res in arr1) { Console.WriteLine(res); } Console.WriteLine("BitArray2 elements..."); ... Read More

583 Views
To check whether a thread is alive or not, the code is as follows −Example Live Demousing System; using System.Threading; public class Demo { public static void Main() { Thread thread = new Thread(new ThreadStart(demo1)); thread = Thread.CurrentThread; Console.WriteLine("Is the thread alive? = "+thread.IsAlive); ThreadPool.QueueUserWorkItem(new WaitCallback(demo2)); Console.WriteLine("Current state of Thread = "+thread.ThreadState); Console.WriteLine("ManagedThreadId = "+thread.ManagedThreadId); thread.IsBackground = true; Console.WriteLine("Is the Thread a background thread? = "+thread.IsBackground); } public static void demo1() { ... Read More