Server Side Programming Articles

Page 767 of 2109

What are the differences between class methods and class members in C#?

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

In C#, understanding the difference between class members and class methods is fundamental to object-oriented programming. Class members are the data components that store the state of an object, while class methods are the functions that operate on that data and define the object's behavior. Class Members vs Class Methods Class Members Class Methods Store data and represent the state of an object Define behavior and operations on the object's data Examples: fields, properties, constants Examples: functions, procedures, constructors Hold values that can change over time Execute ...

Read More

What does the @ prefix do on string literals in C#?

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

The @ prefix in C# creates a verbatim string literal, which means you don't need to escape special characters like backslashes, quotes, or newlines. This makes the string easier to read and write, especially for file paths, regular expressions, and multi-line text. Syntax Following is the syntax for verbatim string literals − @"string content here" To include a double quote inside a verbatim string, use two consecutive quotes − @"He said ""Hello"" to me" Using @ for File Paths The @ prefix eliminates the need to escape backslashes in ...

Read More

What is the difference between a float, double and a decimal in C#?

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

Float, double, and decimal are all value types in C# that represent numeric data with fractional parts. Each type differs in precision, memory size, and intended use cases. Understanding these differences is crucial for choosing the appropriate type for your specific needs. Syntax Following is the syntax for declaring float, double, and decimal variables − float floatValue = 3.14f; // 'f' suffix required double doubleValue = 3.14; // default for literals decimal decimalValue = 3.14m; // 'm' suffix required Float Value Type Float ...

Read More

What are static members of a C# Class?

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

Static members in C# belong to the class itself rather than to any specific instance of the class. When you declare a member as static, only one copy exists regardless of how many objects are created from the class. Static members are accessed using the class name directly, without creating an instance. They are commonly used for utility functions, constants, and shared data that should be consistent across all instances of a class. Syntax Following is the syntax for declaring static members − public static dataType memberName; public static returnType MethodName() { ...

Read More

What is the default access for a class in C#?

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

In C#, when no access modifier is specified for a class, the default access level is internal. An internal class can be accessed from any code within the same assembly but is not accessible from other assemblies. This means that classes declared without an explicit access modifier are visible throughout the current project or assembly, but remain hidden from external assemblies that might reference your code. Syntax Following is the syntax for declaring a class with different access levels − // Default access (internal) class MyClass { } // Explicitly internal internal class MyClass ...

Read More

What is run time polymorphism in C#?

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

Runtime polymorphism in C# allows the same method call to behave differently depending on the actual type of object at runtime. This is achieved through method overriding, also known as dynamic binding or late binding. It is implemented using abstract classes and virtual functions. In runtime polymorphism, the method to be called is determined at runtime based on the object's actual type, not the reference type declared at compile time. Runtime Polymorphism Flow Base Class Circle Rectangle ...

Read More

What is the difference between a class and an object in C#?

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

When you define a class, you define a blueprint or template for a data type. The object is an instance of that class − a concrete implementation created from the blueprint. A class defines the structure and behavior, while objects are the actual entities that hold data and perform actions. The methods and variables that constitute a class are called members of the class. To access class members, you use the dot (.) operator after the object name. The dot operator links the name of an object with the name of a member. Class vs Object ...

Read More

What are the difference between Composition and Aggregation in C#?

Ankith Reddy
Ankith Reddy
Updated on 17-Mar-2026 657 Views

Composition and Aggregation are two important types of associations in C# that represent different levels of dependency between classes. Understanding these relationships helps design better object-oriented systems with proper coupling and lifecycle management. Composition Composition represents a strong "part-of" relationship where the child object cannot exist independently of the parent object. When the parent is destroyed, all child objects are also destroyed automatically. Composition: Strong Ownership Car (Owner) Engine (Owned) ...

Read More

What is early binding in C#?

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

Early binding in C# is the mechanism of linking a method call with its implementation during compile time. It is also called static binding because the method to be called is determined at compilation rather than at runtime. In early binding, the compiler knows exactly which method will be executed based on the method signature (name, parameters, and their types). This results in faster execution since no runtime resolution is needed. How Early Binding Works C# achieves early binding through static polymorphism, which includes method overloading and operator overloading. The compiler resolves which specific method to call ...

Read More

What are unary operators in C#?

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

Unary operators in C# are operators that operate on a single operand. They perform various operations such as incrementing, decrementing, negating, or getting the size of a data type. Complete List of Unary Operators Operator Name Description + Unary plus Indicates positive value (rarely used) - Unary minus Negates the value ! Logical NOT Inverts boolean value ~ Bitwise complement Inverts all bits ++ Increment Increases value by 1 -- Decrement Decreases value by 1 (type) Cast Converts to ...

Read More
Showing 7661–7670 of 21,090 articles
« Prev 1 765 766 767 768 769 2109 Next »
Advertisements