- Trending Categories
- 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 2628 Articles for Csharp
410 Views
Increment OperatorsTo increment a value in C#, you can use the increment operators i.e. Pre-Increment and Post-Increment Operators.The following is an example −Exampleusing System; class Demo { static void Main() { int a = 250; Console.WriteLine(a); a++; Console.WriteLine(a); ++a; Console.WriteLine(a); int b = 0; b = a++; Console.WriteLine(b); Console.WriteLine(a); b = ++a; Console.WriteLine(b); Console.WriteLine(a); ... Read More
4K+ Views
Thread pool in C# is a collection of threads. It is used to perform tasks in the background. When a thread completes a task, it is sent to the queue wherein all the waiting threads are present. This is done so that it can be reused.Let us see how to create a thread pool.Firstly, use the following namespace −using System.Threading;Now, call the threadpool class, using the threadpool object. Call the method QueueUserWorkItem −ThreadPool.QueueUserWorkItem(new WaitCallback(Run)); Iterate this in a loop and compare it with a normal Thread object.
1K+ Views
On Windows, the best IDE to run C# programs is Visual Studio. On Linux, the best IDE can be considered as Monodevelop. It is an open source IDE that allows you to run C# on multiple platforms i.e. Windows, Linux and MacOS. Monodevelop is also known as Xamarin Studio. It has a C# compiler to run C# programs.Monodevelop has the following features −Multi-platform IDESupports Linux, Windows and macOS.Supports multiple languagesMonoDevelop supports multiple languages such as C#, F#, Visual Basic .NET, etc.Integrated DebuggerIt comes with an integrated debugger for debugging Mono and native applications.Code CompletionCode completion support for C#, code templates, ... Read More
1K+ Views
In a Dictionary collection, store any data type. Dictionary is a collection of keys and values in C#. Dictionary is included in the System.Collection.Generics namespace.Let us now see the best way to iterate over a Dictionary in C# −Firstly, let us create a dictionary −var d = new Dictionary(5);Now add the key and value −// add key and value d.Add("car", 25); d.Add("bus", 28); d.Add("motorbike", 17);Use orderby to order by values −var val = from ele in d orderby ele.Value ascending select ele;We have set ascending above to sort the dictionary in ascending order. You can also use descending.Display the values ... Read More
1K+ Views
The alternative for Visual Studio IDE to run C# programs −SharpDevelopIt is an open source IDE to run C# programs but works only Microsoft Windows. SharpDevelop was developed as an alternative to Visual Studio. It is written in C#. Supports Git, SVN, NuGet, LINQPadIt is a utility that allows you to run C# programs without having an IDE. Some of the features in LINQ Pa d is paid like autocomplete and allows the user to access it only after the payment.MonodevelopIt is an open source IDE that allows you to run C# on multiple platforms i.e. Windows, Linux, and MacOS. ... Read More
2K+ Views
Generic List is a generic collection in C#. The size can be dynamically increased using List, unlike Arrays.Let us see an example −We have set the List first −List myList = new List()Now add elements in the list −List myList = new List() { "mammals", "reptiles", "amphibians" }Now using a property let us count the number of elements added −Exampleusing System; using System.Collections.Generic; class Program { static void Main() { List myList = new List() { "mammals", "reptiles", "amphibians" }; Console.WriteLine(myList.Count); } }
2K+ Views
Dictionary is a collection of keys and values in C#. Dictionary is included in the System.Collection.Generics namespace.To declare and initialize a Dictionary −IDictionary d = new Dictionary();Above, types of key and value are set while declaring a dictionary object. An int is a type of key and string is a type of value. Both will get stored in a dictionary object named d.Let us now see an example −Exampleusing System; using System.Collections.Generic; public class Demo { public static void Main() { IDictionary d = new Dictionary(); d.Add(1, 97); d.Add(2, ... Read More
236 Views
The best IDE for C# on Windows is Microsoft Visual Studio. It is an IDE to develop websites, web apps, mobile apps, etc.The following are the features of Visual Studio IDE−Code Editor − Visual Studio has a code editor supporting syntax highlighting and code completion using IntelliSense.Breakpoints − Set breakpoints and allow monitoring the variable values as the execution progress.Extend Capability − With Visual Studio, you can extend the functionality of the IDE. The extension includes macros, packages, etc.Built-in-languages − Visual Studio supports more than 30 programming languages, including C#, F#, JavaScript, TypeScript, etc.
1K+ Views
When creating a class, instead of writing completely new data members and member functions, the programmer can designate that the new class should inherit the members of an existing class. This existing class is called the base class, and the new class is referred to as the derived class.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.The following is the syntax of base class in C# − class { ... } class : { ... }Let ... Read More
13K+ Views
The following table displays the C# equivalent of SQL Server datatypes −SQL Server data typeEquivalent C# data typevarbinaryByte[]binaryByte[]imageNonevarcharNonecharNonenvarcharString, Char[]ncharString, Char[]textNonentextNonerowversionByte[]bitBooleantinyintBytesmallintInt16intInt32bigintInt64smallmoneyDecimalmoneyDecimalnumericDecimaldecimalDecimalrealSinglefloatDoublesmalldatetimeDateTimedatetimeDateTimetableNonecursorNonetimestampNonexmlNone