Server Side Programming Articles

Page 839 of 2109

Difference between Boxing and Unboxing in C#

Samual Sam
Samual Sam
Updated on 17-Mar-2026 1K+ Views

Boxing converts a value type to an object type, whereas unboxing converts an object type back to the value type. These operations are fundamental concepts in C# that involve moving data between the stack and heap memory. Boxing occurs implicitly when you assign a value type to an object variable, while unboxing requires explicit casting and can throw exceptions if the types don't match. Syntax Following is the syntax for boxing (implicit conversion) − object boxedValue = valueType; Following is the syntax for unboxing (explicit conversion) − ValueType unboxedValue = (ValueType)boxedObject; ...

Read More

Differences between C++ and C#

karthikeya Boyini
karthikeya Boyini
Updated on 17-Mar-2026 531 Views

C++ is a statically typed, compiled, general-purpose, case-sensitive programming language that supports procedural, object-oriented, and generic programming paradigms. It is regarded as a middle-level language because it combines both high-level and low-level language features. C# is a simple, modern, general-purpose, object-oriented programming language developed by Microsoft within its .NET initiative, led by Anders Hejlsberg. Both languages share some similarities but differ significantly in design philosophy and implementation. Key Differences Between C++ and C# Memory Management C++ uses manual memory management where developers must explicitly allocate and deallocate memory using new and delete operators. C# features automatic ...

Read More

Different Methods to find Prime Numbers in C#

George John
George John
Updated on 17-Mar-2026 638 Views

A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. In C#, there are several methods to check if a number is prime, each with different approaches and efficiency levels. What is a Prime Number? A prime number is divisible only by 1 and itself. For example, 2, 3, 5, 7, 11 are prime numbers. The number 1 is not considered prime, and 2 is the only even prime number. Prime vs Composite Numbers Prime Numbers ...

Read More

What is the IsReadOnly property of Hashtable class in C#?

Chandu yadav
Chandu yadav
Updated on 17-Mar-2026 171 Views

The IsReadOnly property of the Hashtable class in C# returns a boolean value indicating whether the Hashtable is read-only. When a Hashtable is read-only, you cannot add, remove, or modify its elements. By default, all Hashtable instances created using the standard constructor are not read-only, meaning they allow modifications. However, you can create read-only wrappers using specific methods. Syntax Following is the syntax for accessing the IsReadOnly property − bool isReadOnly = hashtable.IsReadOnly; Return Value The IsReadOnly property returns − true if the Hashtable is read-only false if the Hashtable ...

Read More

Difference between IComparable and IComparer Interface in C#

karthikeya Boyini
karthikeya Boyini
Updated on 17-Mar-2026 2K+ Views

The IComparable and IComparer interfaces in C# are both used for sorting and comparing objects, but they serve different purposes and are implemented in different ways. The IComparable interface allows an object to compare itself with another object of the same type. The IComparer interface provides a way to compare two objects externally, offering more flexibility for custom sorting logic. Syntax Following is the syntax for implementing IComparable − public class ClassName : IComparable { public int CompareTo(object obj) { // comparison logic ...

Read More

Differences between C and C#

Arjun Thakur
Arjun Thakur
Updated on 17-Mar-2026 2K+ Views

C is a general-purpose, high-level programming language originally developed by Dennis M. Ritchie to develop the UNIX operating system at Bell Labs. C was first implemented on the DEC PDP-11 computer in 1972. C# is a simple, modern, general-purpose, object-oriented programming language developed by Microsoft within its .NET initiative led by Anders Hejlsberg. It was designed to combine the power of C++ with the simplicity of Visual Basic. While both languages share the letter "C" in their names, they represent different programming paradigms and approaches. Here are the key differences between C and C#. ...

Read More

Division Operator in C#

Samual Sam
Samual Sam
Updated on 17-Mar-2026 7K+ Views

The division operator (/) in C# is used to divide one number by another. It performs mathematical division between a numerator and denominator, such as 9 / 3 = 3. The division operator is part of the arithmetic operators in C# and behaves differently depending on the data types involved. Understanding these differences is crucial for accurate calculations. Syntax Following is the syntax for the division operator − result = numerator / denominator; Integer Division When both operands are integers, C# performs integer division, which truncates the decimal part and returns only ...

Read More

Enum with Customized Value in C#

George John
George John
Updated on 17-Mar-2026 2K+ Views

An enum (enumeration) in C# is used to store a set of named constants such as days of the week, months, seasons, or any fixed collection of related values. By default, enum constants start from 0 and increment by 1, but you can customize these values to match your specific requirements. Customizing enum values is useful when you need specific numeric representations, want to maintain compatibility with external systems, or need non-sequential numbering. Syntax Following is the syntax for declaring an enum with customized values − public enum EnumName { Value1 ...

Read More

Comparing dates using C#

Samual Sam
Samual Sam
Updated on 17-Mar-2026 384 Views

Comparing dates in C# is accomplished using the DateTime structure, which provides built-in comparison operators and methods. The DateTime class allows you to compare dates using standard operators like , ==, and specialized methods like Compare(). Syntax Following is the syntax for creating DateTime objects for comparison − DateTime date1 = new DateTime(year, month, day); DateTime date2 = new DateTime(year, month, day); Following are the comparison operators and methods available − // Using comparison operators if (date1 < date2) { } if (date1 > date2) { } if (date1 == date2) { ...

Read More

Comparison between C# and .NET Framework

Arjun Thakur
Arjun Thakur
Updated on 17-Mar-2026 710 Views

C# is a programming language, while the .NET Framework is a comprehensive software development platform created by Microsoft. Understanding the relationship between these two is fundamental for .NET developers. The .NET Framework provides the Common Language Runtime (CLR), which serves as the execution environment for .NET applications. It also includes an extensive Base Class Library (BCL) that offers pre-built functionality for common programming tasks. What is C#? C# is an object-oriented programming language that runs on the .NET Framework. It was designed specifically for the .NET platform and compiles to Intermediate Language (IL) code, which the CLR ...

Read More
Showing 8381–8390 of 21,090 articles
« Prev 1 837 838 839 840 841 2109 Next »
Advertisements