Arjun Thakur has Published 1109 Articles

How to display Absolute value of a number in C#?

Arjun Thakur

Arjun Thakur

Updated on 20-Jun-2020 16:01:08

2K+ Views

To find the absolute value of a number in C#, use the Math.Abs method.Set numbers first −int val1 = 77; int val2 = -88;Now take two new variables and get the Absolute value of the above two numbers −int abs1 = Math.Abs(val1); int abs2 = Math.Abs(val2);Let us see the complete ... Read More

What is composition in C#?

Arjun Thakur

Arjun Thakur

Updated on 20-Jun-2020 15:54:17

412 Views

If the parent object is deleted under Composition, then the child object also loses its status. The composition is a special type of Aggregation and gives a part-of relationship.For example, A Car has an engine. If the car is destroyed, the engine is destroyed as well.public class Engine {    . ... Read More

What are pointers in C#?

Arjun Thakur

Arjun Thakur

Updated on 20-Jun-2020 15:38:39

5K+ Views

Pointer is a variable whose value is the address of another variable i.e., the direct address of the memory location.The syntax of a pointer is −type *var-name;The following is how you can declare a pointer type −double *z; /* pointer to a double */C# allows using pointer variables in a ... Read More

How to use C# BinaryReader class?

Arjun Thakur

Arjun Thakur

Updated on 20-Jun-2020 15:28:41

127 Views

Use the BinaryReader class if you want to read binary information from the stream.The BinaryReader class is in System.IO namespace.The following is an example showing using the BinaryReader class to read from a file −static void WriteMe() {    using (BinaryWriter w = new BinaryWriter(File.Open("C:\abc.txt", FileMode.Create))) {       ... Read More

How to display the name of the Current Thread in C#?

Arjun Thakur

Arjun Thakur

Updated on 20-Jun-2020 15:08:48

2K+ Views

Use the Name property to display the name of the current thread in C#.Firstly, use the currentThread property to display information about a thread −Thread thread = Thread.CurrentThread;Now use the thread.Name property to display name of the thread −thread.NameLet us see the complete code show current thread’s name in C# ... Read More

How to capture null reference exception in C#?

Arjun Thakur

Arjun Thakur

Updated on 20-Jun-2020 14:54:23

227 Views

It handles errors generated from referencing a null object. The Null reference exception occurs when you are looking to access member fields or function types that points to null.Let’s say we have the following null string −string str = null;Now you try to get the length of the null string, ... Read More

Static binding vs Dynamic binding in C#

Arjun Thakur

Arjun Thakur

Updated on 20-Jun-2020 14:49:26

2K+ Views

Polymorphism can be static or dynamic. In static polymorphism, the response to a function is determined at the compile time. In dynamic polymorphism, it is decided at run-time.Compile Time Polymorphism or Static BindingThe mechanism of linking a function with an object during compile time is called early binding. It is ... Read More

Fibonacci Series in C#

Arjun Thakur

Arjun Thakur

Updated on 20-Jun-2020 14:17:48

6K+ Views

To find Fibonaccli series, firsty set the first two number in the series as 0 and 1.int val1 = 0, val2 = 1, vNow loop through 2 to n and find the fibonai series. Every number in the series is the sum of the last 2 elements −for(i=2;i

CSS Box Shadow

Arjun Thakur

Arjun Thakur

Updated on 20-Jun-2020 13:24:40

280 Views

The CSS box-shadow property is used to add shadow effects to elements. The following is an example to add a box shadowExampleLive Demo                    div {             width: 300px;             height: 100px;             padding: 15px;             background-color: red;             box-shadow: 10px 10px;          }                     This is a div element with a box-shadow     Output

How can we update MySQL table after removing a particular string from the values of column?

Arjun Thakur

Arjun Thakur

Updated on 20-Jun-2020 13:22:08

350 Views

We can update MySQL table after removing a particular string from the values of a column by using TRIM() function along with UPDATE clause. Following the example from ‘examination_btech’ table will make it clearer −ExampleSuppose if we want to delete the values ‘(CSE)’, from last, of column ‘Course’ and want to update the table ... Read More

Advertisements