- 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
Samual Sam has Published 2492 Articles
Samual Sam
632 Views
Use Stopwatch class to measure time of execution of a method in .NET −Stopwatch s = Stopwatch.StartNew();Now set a function and use the ElapsedMilliseconds property to get the execution time in milliseconds −s.ElapsedMillisecondsLet us see the complete code −Example Live Demousing System; using System.IO; using System.Diagnostics; public class Demo { ... Read More
Samual Sam
235 Views
For volume and surface area of a sphere, firstly declare a variable with the value of radius.int r = 15;Get the volume f the sphere.// calculating volume of sphere cal_volume = (4.0 / 3) * (22 / 7) * r * r * r;Now the surface area of the sphere ... Read More
Samual Sam
148 Views
The following is our integer array −int[] myArr = new int[6] { 8, 4, 2, 5, 9, 14 };Firstly, get the length of the array, and loop through the array to find the sum of the elements. After that, divide it with the length.int ... Read More
Samual Sam
464 Views
To find the product of two binary numbers, firstly set them.val1 = 11100; val2 = 10001; Console.WriteLine("Binary one: "+val1); Console.WriteLine("Binary two: "+val2);Now loop through to get the product.while (val2 != 0) { digit = val2 % 10; if (digit == 1) { val1 = ... Read More
Samual Sam
559 Views
Using Synchronization, you can synchronize access to resources in multithreaded applications.A mutex can be used to synchronize threads across processes Use it to prevent the simultaneous execution of a block of code by more than one thread at a time.C# lock statement is used to ensure that a block of ... Read More
Samual Sam
669 Views
Set the first list.int[] arr1 = { 65, 57, 63, 98 };Now, set the second list.int[] arr2 = { 43, 65, 33, 57 };Let us now see the complete code to check if two lists have common elements using == and < ... Read More
Samual Sam
5K+ Views
Set the list.List < int > list = new List < int > (); list.Add(99); list.Add(49); list.Add(32);To get unique elements.List myList = list.Distinct().ToList();Here is the complete example to display unique values from a list.Example Live Demousing System; using System.Collections.Generic; using System.Linq; public class Demo { public static void Main() ... Read More
Samual Sam
1K+ Views
The Mutex class in C# is a synchronization primitive that can also be used for interprocess synchronization.Let us see how to create a new Mutex.private static Mutex m = new Mutex();Let us now see how to initialize a new instance of the Mutex class with a Boolean value.private static Mutex ... Read More
Samual Sam
4K+ Views
Firstly, set a string array.string[] values = { "tim", "amit", "tom", "jack", "saurav"};Use the Sort() method to sort.Array.Sort(values);Let us see the complete code −Example Live Demousing System; public class Program { public static void Main() { string[] values = { "tim", "amit", "tom", "jack", "saurav"}; ... Read More
Samual Sam
1K+ Views
Take two arrays:int[] arr2 = new int[5]; int[] arr3 = new int[5];Now, if the array element gets the remainder 0 on dividing by 2, it is even. Get those elements and add in another array. This loops through the length of the array:if (arr1[i] % 2 == 0) { ... Read More