Difference Between Trim and TrimStart Methods in C#

Ankith Reddy
Updated on 22-Jun-2020 07:36:46

1K+ Views

TrimA string method that removes all the leading and trailing whitespaces in a string.For example, the string “jack sparrow“ would be returned as the following without leading and whitespaces using trim().jack sparrowThe following is an example −Example Live Demousing System; namespace Demo {    class Program {       static void Main(string[] args) {          string str = " Amit ";          Console.WriteLine(str);          // trim          Console.WriteLine("After removing leading and trailing whitespace...");          string res = str.Trim();          Console.WriteLine(res); ... Read More

Difference Between Dynamic Type Variables and Object Type Variables

Samual Sam
Updated on 22-Jun-2020 07:36:03

2K+ Views

You can store any type of value in the dynamic data type variable. Type checking for these types of variables takes place at run-time.The Object Type is the ultimate base class for all data types in C# Common Type System (CTS). The object is an alias for System. Object class. The object types can be assigned values of any other types, value types, reference types, predefined or user-defined types.Dynamic types are similar to object types except that type checking for object type variables takes place at compile time, whereas that for the dynamic type variables takes place at runtime.Example of ... Read More

Difference between Prefix and Postfix Operators in C#

Arjun Thakur
Updated on 22-Jun-2020 07:35:26

7K+ Views

Prefix OperatorThe increment operator ++ if used as prefix on a variable, the value of variable gets incremented by 1. After that the value is returned unlike Postfix operator. It is called Prefix increment operator. In the same way the prefix decrement operator works but it decrements by 1.For example, an example of prefix operator −++a;The following is an example demonstrating Prefix increment operator −Example Live Demousing System; class Program {    static void Main() {       int a, b;       a = 50;       Console.WriteLine(++a);       b = a;     ... Read More

Important Keywords in Chash

karthikeya Boyini
Updated on 22-Jun-2020 07:34:54

392 Views

Some of the key keywords in C#, include.SealedParamsInternalthisabstractSealedWhen you use sealed modifiers in C# on a method, then the method loses its capabilities of overriding. The sealed method should be part of a derived class and the method must be an overridden method.ParamsWhile declaring a method, you are not sure of the number of arguments passed as a parameter, then use params. C# param arrays can let you know about this.InternalInternal access specifier allows a class to expose its member variables and member functions to other functions and objects in the current assembly. Any member with internal access specifier can ... Read More

Inbuilt Data Structures in C#

Chandu yadav
Updated on 22-Jun-2020 07:34:37

567 Views

C# has a lot of inbuilt Data Structures. Here are two of them −ListGeneric List is a generic collection and the ArrayList is a non-generic collection. The size can be dynamicallyincreased using List, unlike Arrays.Let us see an example.We have set the List first −List myList = new List()ArrayListIt represents ordered collection of an object that can be indexed individually.Set an ArrayList as −ArrayList arr = new ArrayList(); arr.Add(67); arr.Add(34); arr.Add(99); arr.Add(45);

CSS Position Static

George John
Updated on 22-Jun-2020 07:34:21

269 Views

The position: static; property sets the position of an element static, which is the default.ExampleThe top, bottom, left, and right properties does not affect the the static positioned elements. You can try to run the following code to implement the CSS position: static; propertyLive Demo                    div.static {             position: static;             border: 3px solid blue;          }                     Positioning Element                       div element with position: static;               Output

Increment and Decrement Operators in C#

Samual Sam
Updated on 22-Jun-2020 07:34:05

7K+ Views

Increment operator increases integer value by one i.e.int a = 10; a++; ++a;Decrement operator decreases integer value by one i.e.int a = 20; a--; --a;The following is an example demonstrating increment operator −Example Live Demousing System; class Program {    static void Main() {       int a, b;       a = 10;       Console.WriteLine(++a);       Console.WriteLine(a++);       b = a;       Console.WriteLine(a);       Console.WriteLine(b);    } }Output11 11 12 12The following is an example demonstrating decrement operator −int a, b; a = 10; // displaying decrement operator result Console.WriteLine(--a); Console.WriteLine(a--); b = a; Console.WriteLine(a); Console.WriteLine(b);

Difference Between Break and Continue Statements in C#

George John
Updated on 22-Jun-2020 07:33:25

2K+ Views

The break statement terminates the loop and transfers execution to the statement immediately following the loop.The continue statement causes the loop to skip the remainder of its body and immediately retest its condition prior to reiterating.When the break statement is encountered inside a loop, the loop is immediately terminated and program control resumes at the next statement following the loop.The continue statement in C# works somewhat like the break statement. Instead of forcing termination, however, continue forces the next iteration of the loop to take place, skipping any code in between.The following is the complete code to use continue statement in a ... Read More

Advantage of CONCAT_WS Over CONCAT in SQL

Paul Richard
Updated on 22-Jun-2020 07:31:18

174 Views

As we know that CONCAT() function returns NULL if any of the arguments is NULL but CONCAT_WS() function returns NULL only if the first argument i.e. the separator is NULL and it ignores any other NULL. We can say this is the advantage of CONCAT_WS() function over CONCAT() function when we want to concatenate the values from the column and any of the columns have NULL as its value. To understand it, we consider the example from the table ‘Student_name; which have the following data −mysql> Select * from Student_Name; +---------+-------+---------+ | FName   | Mname | Lname   | ... Read More

Generate the First 100 Odd Numbers Using Chash

Chandu yadav
Updated on 22-Jun-2020 07:31:12

894 Views

To generate first 100 odd numbers, set a for loop from 1 to 100.for(val = 1; val

Advertisements