- 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
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
255 Views
The Array.SyncRoot property is used to get an object that can be used to synchronize access to the Array. The classes that have arrays can also use the SyncRoot property to implement their own synchronization.Enumerating through a collection is not a thread safe procedure. The other threads may modify the collection even when the collection is synchronized. This would eventually cause the enumerator to throw an exception. For this, you need to lock the collection.Let us see an example to work with Array.SyncRoot property −Example Live Demousing System; using System.Collections.Generic; using System.Linq; class Program { static void Main() { ... Read More
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
185 Views
C# is a simple, modern, general-purpose, object-oriented programming language developed by Microsoft within its .NET initiative led by Anders Hejlsberg.C++ is a middle-level programming language developed by Bjarne Stroustrup starting in 1979 at Bell Labs. C++ runs on a variety of platforms, such as Windows, Mac OS, and the various versions of UNIX.The following are some of the features of C++ missing in C# −In C#, Multiple Inheritance is not possible, whereas C++ can easily implement Multiple Inheritance.In C++, you need to manage memory manually and must allocate and deallocate memory for your objects.C++ can create standalone applications, whereas C# ... Read More
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
590 Views
HashSet in C# eliminates duplicate strings or elements in an array.In C#, it is an optimized set collection.Let us see an example to remove duplicate strings using C# HashSet. Here, we have duplicate elements −Example Live Demousing System; using System.Collections.Generic; using System.Linq; class Program { static void Main() { string[] arr1 = { "bus", "truck", "bus", "car", "truck" }; Console.WriteLine(string.Join(", ", arr1)); // HashSet ... Read More
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
299 Views
Integer LiteralsAn integer literal can be a decimal, or hexadecimal constant. A prefix specifies the base or radix: 0x or 0X for hexadecimal, and there is no prefix id for decimal. Here are some of the examples of integer literals −10 // int 18u // unsigned intLet’s use the above literal while declaring and initializing a variable −// int int a =10;We will now print the values −Example Live Demousing System; namespace Demo { class Program { static void Main(string[] args) { // int int a =200; ... Read More
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
1K+ Views
Console.ReadKey(); is for the VS.NET Users. This makes the program wait for a key press and it prevents the screen from running and closing quickly when the program is launched from Visual Studio .NET.A common use of the ReadKey() method is that you can halt the program execution. This could be done until a key is pressed by the user.Let us see an example −Example Live Demousing System; public class Demo { public static void Main() { DateTime date = DateTime.Now; TimeZoneInfo timeZone = TimeZoneInfo.Local; Console.WriteLine("Time Zone = {0}", timeZone.IsDaylightSavingTime(date) ... Read More
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
282 Views
To determine if a string has unique characters or not, firstly check a word in the string with the next word −for (int j = i + 1; j < val.Length; j++) { if (val[i] == val[j]) }If you find a match, that would mean the string do not have unique characters.If you are unable to find a match, then the string has all unique characters.In case of a match, return false i.e. unique characters not found −for (int j = i + 1; j < val.Length; j++) { if (val[i] == val[j]) return false; }
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
66 Views
The Array.IsSynchronized property in C gets a value indicating whether access to the Array is synchronized.The IsSynchronized property is implemented by Arrays because it is needed by the System.Collections.ICollection interface. Classes using arrays can also implement own synchronization using the SyncRoot property.The following is the syntax −public bool IsSynchronized { get; }The Array.IsSynchronized property implementation is the same like the SyncRoot property −Example Live Demousing System; using System.Collections.Generic; using System.Linq; class Program { static void Main() { Array arr = new int[] { 2, 1, 9, 4, 8, 6,8 }; lock(arr.SyncRoot) { foreach (Object val in arr) Console.WriteLine(val); } } }Output2 1 9 4 8 6 8
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
160 Views
The different ways with which a method can be overloaded is −The datatypes of parameters are different The number of parameters are differentThe following gives an example stating different datatypes of parameters −void print(int i) { Console.WriteLine("Printing int: {0}", i ); } void print(double f) { Console.WriteLine("Printing float: {0}" , f); } void print(string s) { Console.WriteLine("Printing string: {0}", s); }The following states the different number of parameters −// two parameters public static int mulDisplay(int one, int two) { return one * two; } // three parameters public static int mulDisplay(int one, int ... Read More
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
9K+ Views
To delete an elements from a C# array, we will shift the elements from the position the user want the element to delete.Here, first we have 5 elements −int[] arr = new int[5] {35, 50, 55, 77, 98};Now let’s say we need to delete the element at 2nd position i.e. variable “pos = 2” is set, for that shift the elements after the specified position −// Shifting elements for (i = pos-1; i < 4; i++) { arr[i] = arr[i + 1]; }Now display the result as shown in the complete code below.Example Live Demousing System; using System.Collections.Generic; using System.Linq; ... Read More