Samual Sam has Published 2310 Articles

What is static binding in C#?

Samual Sam

Samual Sam

Updated on 22-Jun-2020 07:21:02

1K+ Views

The linking of a function with an object during compile time is called static binding. C# provides two techniques to implement static polymorphism: Function overloading and Operator overloading.In Function Overloading, you can have multiple definitions for the same function name in the same scope.Examplevoid print(int i) {    Console.WriteLine("Printing int: ... Read More

What is the difference between an interface and an abstract class in C#?

Samual Sam

Samual Sam

Updated on 22-Jun-2020 07:17:37

580 Views

Interfaces define properties, methods, and events, which are the members of the interface. Interfaces contain only the declaration of the members. It is the responsibility of the deriving class to define the members.Abstract classes to some extent serve the same purpose, however, they are mostly used when only a few ... Read More

How does the precedence of || operator depend on PIPES_AS_CONCAT SQL mode?

Samual Sam

Samual Sam

Updated on 22-Jun-2020 06:23:31

226 Views

As we know that in MySQL by default || operator is a logical OR operator but it depends upon PIPES_AS_CONCAT SQL mode. If PIPES_AS_CONCAT SQL mode is enabled, then || operator works as string concatenation. At that time its precedence would be between ^ and the unary operator. Following example ... Read More

How MySQL evaluates when I use a conditional expression within SUM() function?

Samual Sam

Samual Sam

Updated on 22-Jun-2020 05:30:20

150 Views

As we know that, by using a conditional expression within SUM() function we can get the number of rows that meet the condition. So, in this case, MySQL evaluates to 1 each time the condition is true and 0 each time it is false.To understand it, consider the following example ... Read More

What is the difference between String and string in C#?

Samual Sam

Samual Sam

Updated on 21-Jun-2020 16:56:33

565 Views

String stands for System.String whereas string is an alias in C# for System.String −For examplestring str = "Welcome!";It’s not essential, but generally String is used when you work with classes.string str = String.Format("Welcome! {0}!", user);Since the string is an alias for System. String. The alias for other datatypes are −Exampleobject: ... Read More

System.ArrayCopyTo() vs System.ArrayClone() in C#

Samual Sam

Samual Sam

Updated on 21-Jun-2020 16:53:51

290 Views

The ArrayCopyTo() method copies all the elements of the current one-dimensional Array to the specified one-dimensional Array starting at the specified destination Array index. The index is specified as a 32-bit integer.The CopyTo() method in C# is used to copy elements of one array to another array. In this method, ... Read More

What are virtual functions in C#?

Samual Sam

Samual Sam

Updated on 21-Jun-2020 16:51:25

5K+ Views

The virtual keyword is useful in modifying a method, property, indexer, or event. When you have a function defined in a class that you want to be implemented in an inherited class(es), you use virtual functions. The virtual functions could be implemented differently in different inherited class and the call ... Read More

String Literal Vs String Object in C#

Samual Sam

Samual Sam

Updated on 21-Jun-2020 16:34:25

1K+ Views

String LiteralsString literals or constants are enclosed in double quotes "" or with @"". A string contains characters that are similar to character literals: plain characters, escape sequences, and universal characters.Here are some examples of String Literals −Hello, World" "Welcome, \The following is an example showing the usage of string ... Read More

Overriding Vs Shadowing in C#

Samual Sam

Samual Sam

Updated on 21-Jun-2020 16:29:43

2K+ Views

OverridingUnder overriding, you can define a behavior that's specific to the subclass type, which means a subclass can implement a parent class method based on its requirement.Let us see an example of abstract classes that implements Overriding −Exampleusing System; namespace PolymorphismApplication {    abstract class Shape {     ... Read More

Trim (Remove leading and trailing spaces) a string in C#

Samual Sam

Samual Sam

Updated on 21-Jun-2020 16:22:39

881 Views

To trim a string in C#, use regular expression.Firstly, set the pattern for regex −string pattern = "\s+";Let’s say the following is our string with leading and trailing spaces −string input = " Welcome User ";Now using Regex, set the pattern and get the result in a new string in ... Read More

Advertisements