Samual Sam has Published 2310 Articles

C# program to check if string is panagram or not

Samual Sam

Samual Sam

Updated on 19-Jun-2020 08:28:49

2K+ Views

A pangram has all the 26 letters of an alphabet.Below, we have entered a string, and will check whether it is a pangram or not −string str = "The quick brown fox jumps over the lazy dog";Now, check using the ToLower(), isLetter() and Count() functions that the string has all ... Read More

Boxing and Unboxing in C#

Samual Sam

Samual Sam

Updated on 19-Jun-2020 08:25:57

2K+ Views

BoxingBoxing is the implicit conversion of a value type to a reference type.UnboxingUnboxing is the explicit conversion of the reference type created by boxing, back to a value type.ExampleLet us see an example code snippet −// int int myVal = 12; // Boxing object myBoxed = myVal; // Unboxing int ... Read More

Background Worker Class in C#

Samual Sam

Samual Sam

Updated on 19-Jun-2020 08:24:59

2K+ Views

As the name suggests the Background Worker Class allows you to set a thread continuously running in the background and communicating with the main thread whenever required.BackgroundWorker makes the implementation of threads in Windows Forms. Intensive tasks need to be done on another thread so the UI does not freeze. ... Read More

BigInteger Class in C#

Samual Sam

Samual Sam

Updated on 19-Jun-2020 08:22:08

568 Views

Use the BigInteger to handle big numbers in C#. The assembly to add for BigInteger is System. Numerics.In c# Big integer is found in System.Numerics.BigInteger.SyntaxThe syntax of BigInteger −[SerializableAttribute] public struct BigInteger : IFormattable, IComparable, IComparable, IEquatableLet us see an example code snippet −BigInteger num = BigInteger.Multiply(Int64.MaxValue, Int64.MaxValue);You can create ... Read More

Binary to decimal using C#

Samual Sam

Samual Sam

Updated on 19-Jun-2020 08:18:40

297 Views

To convert binary to decimal, here I have used a while loop and found the remainder of the Binary number, which is the input. After that, the remainder is multiplied by the base value and added.This is what I did to get the decimal value −while (val > 0) { ... Read More

C# program to check if binary representation is palindrome

Samual Sam

Samual Sam

Updated on 19-Jun-2020 08:15:05

334 Views

To check for palindrome, let us say our number is 5, whose binary is −101The palindrome of 101 is 101 and to check you need to reverse the bits using the following function. Here, bitwise left and bitwise right shift operators are used −public static long funcReverse(long num) {   ... Read More

Are arrays zero indexed in C#?

Samual Sam

Samual Sam

Updated on 19-Jun-2020 08:13:38

1K+ Views

Yes, arrays zero indexed in C#. Let us see how −If the array is empty, it has zero elements and has length 0.If the array has one element in 0 indexes, then it has length 1.If the array has two elements in 0 and 1 indexes, then it has length ... Read More

abstract keyword in C#

Samual Sam

Samual Sam

Updated on 19-Jun-2020 08:12:01

684 Views

The abstract keyword in C# is used for abstract classes. An abstract class in C# includes abstract and nonabstract methods. You cannot instantiate an abstract class.Example of an abstract class Vehicle and abstract method display() −public abstract class Vehicle {    public abstract void display(); }The abstract class has derived ... Read More

Three Different ways to calculate factorial in C#

Samual Sam

Samual Sam

Updated on 19-Jun-2020 08:08:47

753 Views

To calculate a factorial in C#, you can use any of the following three ways −Calculate factorial with for loopExampleLive Demousing System; using System.Collections.Generic; using System.Linq; using System.Text; namespace factorial {    class Test {       static void Main(string[] args) {          int i, ... Read More

Association, Composition and Aggregation in C#

Samual Sam

Samual Sam

Updated on 19-Jun-2020 08:06:31

6K+ Views

Association in C#The association defines the relationship between an object in C#. An a one-to-one, one-to-many, many-to-one and many-to-many relationship can be defined between objects.For example, An Employee can be associated with multiple projects, whereas a project can have more than one employee.Composition in C#Under Composition, if the parent object ... Read More

Advertisements