 
 Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Server Side Programming Articles - Page 2523 of 2650
 
 
			
			3K+ Views
Ternary operator is a Conditional operator in C#. It takes three arguments and evaluates a Boolean expression.For example −b = (a == 1) ? 20 : 30;Above, if the first operand evaluates to true (1), the second operand is evaluated. If the first operand evaluates to false (0), the third operand is evaluated.The following is an example −Example Live Demousing System; namespace DEMO { class Program { static void Main(string[] args) { int a, b; a = 10; b = (a == 1) ? 20 : 30; Console.WriteLine("Value of b is {0}", b); b = (a == 10) ? 20 : 30; Console.WriteLine("Value of b is {0}", b); Console.ReadLine(); } } }OutputValue of b is 30 Value of b is 20
 
 
			
			3K+ Views
We can define class members as static using the static keyword. When we declare a member of a class as static, it means no matter how many objects of the class are created, there is only one copy of the static member.The keyword static implies that only one instance of the member exists for a class. Static variables are used for defining constants because their values can be retrieved by invoking the class without creating an instance of it.The following is an example showing the usage of static variables −Example Live Demousing System; namespace StaticVarApplication { class StaticVar { ... Read More
 
 
			
			709 Views
A thread is defined as the execution path of a program. Each thread defines a unique flow of control. If your application involves complicated and time-consuming operations, then it is often helpful to set different execution paths or threads, with each thread performing a particular job.The life cycle of a thread starts when an object of the System.Threading.Thread class is created and ends when the thread is terminated or completes execution.The following are the various states in the life cycle of a thread −The Unstarted State - It is the situation when the instance of the thread is created but ... Read More
 
 
			
			2K+ Views
A pointer is a variable whose value is the address of another variable i.e., the direct address of the memory location. Similar to any variable or constant, you must declare a pointer before you can use it to store any variable address.The syntax of a pointer is −type *var-name;The following is how you can declare a pointer type −int *ip; /* pointer to an integer */ double *dp; /* pointer to a double */C# allows using pointer variables in a function of code block when it is marked by the unsafe modifier. The unsafe code or the unmanaged code is ... Read More
 
 
			
			3K+ 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 also called static binding or early binding.Run Time Polymorphism or Dynamic BindingRuntime polymorphism has method overriding that is also known as dynamic binding or late binding.Abstract classes contain abstract methods, which are implemented by the derived class. The derived classes have more specialized functionality. Dynamic polymorphism is implemented by abstract classes and virtual functions.Read More
 
 
			
			871 Views
The C# static class cannot be instantiated and can only have only static members. The static class in C# is sealed and cannot contain instance constructors.The following is an example with static class and static members −Example Live Demousing System; public static class Demo { public static float PI = 3.14f; public static int calc(int n){return n*n;} } class Program { public static void Main(string[] args) { Console.WriteLine("PI: "+Demo.PI); Console.WriteLine("Square: " + Demo.calc(3)); } }OutputPI: 3.14 Square: 9Above, the static class is −public static class Demo { ... Read More
 
 
			
			2K+ Views
C# is a modern, general-purpose, object-oriented programming language developed by Microsoft. C# is designed for Common Language Infrastructure (CLI), which consists of the executable code and runtime environment that allows the use of various high-level languages on different computer platforms and architectures.The following are the major features of C# −Following is the list of few important features of C# −Boolean ConditionsAutomatic Garbage CollectionStandard LibraryAssembly VersioningProperties and EventsDelegates and Events ManagementEasy-to-use GenericsIndexersConditional CompilationSimple MultithreadingLINQ and Lambda ExpressionsIntegration with Windows
 
 
			
			1K+ Views
IS operatorThe "is" operator in C# checks whether the run-time type of an object is compatible with a given type or not.The following is the syntax −expr is typeHere, expr is the expressiontype is the name of the typeThe following is an example showing the usage of is operator in C# &minis;Example Live Demousing System; class One { } class Two { } public class Demo { public static void Test(object obj) { One x; Two y; if (obj is One) { Console.WriteLine("Class One"); ... Read More
 
 
			
			3K+ Views
Use the Any method to find whether the list is empty or not.Set the list −var subjects = new List(); subjects.Add("Maths"); subjects.Add("Java"); subjects.Add("English"); subjects.Add("Science"); subjects.Add("Physics"); subjects.Add("Chemistry");Now set the following condition to check whether the list is empty or not −bool isEmpty = !subjects.Any(); if(isEmpty) { Console.WriteLine("Empty"); }else { Console.WriteLine("List is not empty"); }The following is the complete code −Example Live Demousing System; using System.Collections.Generic; using System.Linq; public class Demo { public static void Main(string[] args) { var subjects = new List(); subjects.Add("Maths"); ... Read More