Karthikeya Boyini has Published 2383 Articles

Thread Safe Concurrent Collection in C#

karthikeya Boyini

karthikeya Boyini

Updated on 22-Jun-2020 09:42:10

968 Views

The .NET Framework 4 brought the System.Collections.Concurrent namespace. This has several collection classes that are thread-safe and scalable. These collections are called concurrent collections because they can be accessed by multiple threads at a time.The following are the concurrent collection in C# −Sr.NoType & Description1BlockingCollectionBounding and blocking functionality for any ... Read More

How to compile and execute C# programs on Mac OS?

karthikeya Boyini

karthikeya Boyini

Updated on 22-Jun-2020 09:38:39

1K+ Views

To compile and execute C# programs on Mac, firstly you need to IDE. On MacOS, one of the best IDEs is Monodevelop.Monodevelop 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.Monodevelop has a ... Read More

C# program to find all duplicate elements in an integer array

karthikeya Boyini

karthikeya Boyini

Updated on 22-Jun-2020 09:35:59

6K+ Views

Firstly, set the array with duplicate elements.int[] arr = {    24,    10,    56,    32,    10,    43,    88,    32 };Now declare a Dictionary and loop through the array to get the repeated elements.var d = new Dictionary < int, int > (); foreach(var ... Read More

C# Program to find number of occurrence of a character in a String

karthikeya Boyini

karthikeya Boyini

Updated on 22-Jun-2020 09:30:26

700 Views

Let’s say our string is −String s = "mynameistomhanks";Now create a new array and pass it a new method with the string declared above. This calculates the occurrence of characters in a string.static void calculate(String s, int[] cal) {    for (int i = 0; i < s.Length; i++)   ... Read More

Understanding Logistic Regression in C#

karthikeya Boyini

karthikeya Boyini

Updated on 22-Jun-2020 09:27:23

252 Views

The Logistic regression is a linear model used for binomial regression. It is used in medical science and to predict a customer’s tendency to purchase a product. It makes use of predictor variables for this purpose.Logistic Regression allows easier analysis of results in the form of odds ratios and statistical ... Read More

Formatted string literals in C#

karthikeya Boyini

karthikeya Boyini

Updated on 22-Jun-2020 09:26:44

410 Views

To format string literals in C#, use the String.Format method.In the following example, 0 is the index of the object whose string value gets inserted at that particular position −using System; namespace Demo {    class Test {       static void Main(string[] args) {         ... Read More

C# program to print all distinct elements of a given integer array in C#

karthikeya Boyini

karthikeya Boyini

Updated on 22-Jun-2020 09:22:53

383 Views

We have set an array and a dictionary to get the distinct elements.int[] arr = {    88,    23,    56,    96,    43 }; var d = new Dictionary < int, int > ();Dictionary collection allows us to get the key and value of a list.The following ... Read More

How to print a blank line in C#?

karthikeya Boyini

karthikeya Boyini

Updated on 22-Jun-2020 09:18:05

2K+ Views

To display a line in C#, use the Console.WriteLine().Under that set a blank line −Console.WriteLine(" ");The following is the code that displays a blank line −Example Live Demousing System; namespace Program {    public class Demo {       public static void Main(String[] args) {         ... Read More

C# program to get max occurred character in a String

karthikeya Boyini

karthikeya Boyini

Updated on 22-Jun-2020 09:13:02

587 Views

To get the maximum occurred character in a string, loop until the length of the given string and find the occurrence.With that, set a new array to calculate −for (int i = 0; i < s.Length; i++)    a[s[i]]++; }The values we used above −String s = "livelife!"; int[] a ... Read More

How to print the first ten Fibonacci numbers using C#?

karthikeya Boyini

karthikeya Boyini

Updated on 22-Jun-2020 09:09:04

546 Views

For displaying the first ten numbers, firstly set the first two numbers.int val1 = 0, val2 = 1;Now, use a for loop from 2 to 10, to display first ten Fibonacci numbers −for(i=2;i

Advertisements