Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Server Side Programming Articles
Page 870 of 2109
How to pop the first element from a C# List?
To pop the first element from a C# List, you can use the RemoveAt() method with index 0. This method removes the element at the specified position and shifts all subsequent elements one position to the left. Unlike traditional stack pop operations that return the removed element, RemoveAt() only removes the element. If you need both removal and retrieval, you must first get the element before removing it. Syntax Following is the syntax for removing the first element − list.RemoveAt(0); Following is the syntax for popping (retrieving and removing) the first element − ...
Read MoreAdd key-value pair in C# Dictionary
To add key-value pairs in C# Dictionary, you can use several methods. The Dictionary class provides multiple ways to insert elements, each with its own advantages for different scenarios. Syntax Following are the main syntaxes for adding key-value pairs to a Dictionary − // Using Add() method with separate key and value dictionary.Add(key, value); // Using Add() method with KeyValuePair dictionary.Add(new KeyValuePair(key, value)); // Using indexer syntax dictionary[key] = value; Using Add() Method with Key and Value The most common approach is using the Add() method with separate key and value ...
Read MoreCompilation and Execution of a C# Program
To compile and execute a program in C#, you can use several methods depending on your development environment. The most common approaches include using Visual Studio IDE, command-line tools, or online compilers. Using Visual Studio IDE In Microsoft Visual Studio IDE, compilation and execution is straightforward − Click the Run button or press F5 key to build and execute the project. Visual Studio automatically compiles your code and runs the executable. Any compilation errors will appear in the Error List window. Command-Line Compilation You can compile C# programs using the command-line C# compiler ...
Read MoreAccess Modifiers in C#
Access modifiers in C# control the visibility and accessibility of classes, methods, properties, and other members. They define which parts of your code can access specific members, providing encapsulation and security to your applications. Access Modifiers Overview C# provides five access modifiers that determine the scope and accessibility of class members − C# Access Modifiers Hierarchy public Most accessible protected internal internal protected private ...
Read MoreA Deque Class in C#
A Deque (double-ended queue) is a data structure that allows insertion and deletion of elements from both ends. In C#, while there's no built-in Deque class, we can implement one using a doubly-linked list or utilize existing collections like LinkedList to achieve deque functionality. The key advantage of a deque is its flexibility — you can add and remove elements from both the front and back, making it suitable for scenarios like implementing sliding window algorithms, browser history, or undo/redo operations. Deque Operations A typical deque supports the following core operations − AddFirst() — adds ...
Read MoreBeginning C# programming with Hello World
The following is a simple "Hello World" program in C# programming. This is typically the first program you write when learning a new language, and it demonstrates the basic structure of a C# application. Syntax Following is the basic structure of a C# program − using System; namespace NamespaceName { class ClassName { static void Main(string[] args) { // Your code here } } } Hello ...
Read MoreAbstract Classes in C#
An abstract class in C# includes both abstract and non-abstract methods. A class is declared abstract using the abstract keyword. You cannot instantiate an abstract class directly — it must be inherited by a derived class that provides implementations for all abstract methods. Syntax Following is the syntax for declaring an abstract class and an abstract method − public abstract class ClassName { // Abstract method — no body, must be overridden public abstract void MethodName(); // Non-abstract method — has a body, can be inherited ...
Read More'this' keyword in C#
The this keyword in C# is used to refer to the current instance of the class. It is also used to differentiate between method parameters and class fields when they have the same name. Another usage of the this keyword is to call another constructor from a constructor in the same class, known as constructor chaining. Syntax Following is the syntax for using this to refer to instance members − this.fieldName = value; Following is the syntax for constructor chaining using this − public ClassName(int a) : this(a, 0) { ...
Read MoreHow to save HTML Tables data to CSV in Python
Extracting data from HTML tables and saving it to CSV format is a common task in data science and web scraping. When dealing with multiple tables on a webpage, manual copy-paste becomes impractical, making automated extraction essential. This tutorial demonstrates how to use Python libraries like csv, urllib, and BeautifulSoup to scrape HTML table data and convert it to CSV format efficiently. Required Libraries Before starting, ensure you have the necessary libraries installed − pip install beautifulsoup4 The csv and urllib= len(tables): ...
Read MoreHTML Cleaning and Entity Conversion - Python
Hypertext markup language i.e. HTML is a markup language that is used to create webpages content on the internet. HTML document files may contain some unwanted or malicious elements which can cause several issues while rendering the webpage. Before processing the HTML content we need to perform HTML cleaning for removal and cleaning of the malicious elements in the file. HTML entities are special characters that need to be converted into corresponding HTML representations to ensure proper rendering in browsers. In this article, we will understand cleaning and entity conversion methods using Python. HTML Cleaning HTML cleaning is ...
Read More