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
Articles by varun
65 articles
Valid variant of Main() in C#
The Main method is the entry point for all C# programs. It defines what the class does when executed. When you run a C# application, the runtime looks for the Main method and begins execution from there. Syntax There are several valid variants of the Main method in C# − static void Main() static void Main(string[] args) static int Main() static int Main(string[] args) Parameters static − the object is not needed to access static members. The Main method must be static so the runtime can call it without creating an ...
Read MoreC# equivalent to Java's Thread.setDaemon?
C# equivalent to Java's Thread.setDaemon is the concept of foreground and background threads. In C#, background threads serve the same purpose as daemon threads in Java − they run in the background and are automatically terminated when all foreground threads complete. When all foreground threads terminate, the CLR (Common Language Runtime) automatically shuts down the application, causing all background threads to be terminated immediately. Foreground threads keep the application alive until they complete execution. Syntax Following is the syntax to create a background thread using the IsBackground property − Thread thread = new Thread(methodName); thread.IsBackground ...
Read MoreString Formatting with ToString in C#
The ToString() method in C# is a powerful way to format values into strings using various format specifiers. It provides control over how numbers, dates, and other data types are displayed as text. Syntax Following is the basic syntax for using ToString() with format specifiers − variable.ToString("formatSpecifier"); For numeric formatting with custom patterns − number.ToString("000"); // Zero padding number.ToString("C"); // Currency format number.ToString("F2"); // Fixed-point with 2 decimals Using Zero Padding Format The zero padding format ensures ...
Read MoreHow to properly use h1 in HTML5?
The h1 element in HTML5 defines the most important heading on a page or within a section. Unlike earlier HTML versions, HTML5 allows multiple h1 elements when used properly within sectioning elements like , , , and . The h1 element represents a heading, not a title. Each sectioning element can have its own h1 heading that describes the content of that specific section. The first h1 element in the document body typically serves as the main heading for the entire page. Syntax Following is the basic syntax for the h1 element − Heading Text ...
Read MoreCreate a hidden paragraph in HTML5
The hidden attribute in HTML5 is used to create elements that are not displayed or relevant to the current page state. When applied to a paragraph or any HTML element, it completely hides the content from both visual display and screen readers, making it semantically irrelevant until the attribute is removed. Syntax Following is the syntax for using the hidden attribute − This paragraph is hidden The hidden attribute is a boolean attribute, meaning its presence alone indicates the element should be hidden. You can also write it as hidden="hidden" or hidden="true", but simply ...
Read MoreWhat are start angle and end angle of arc in HTML5 canvas?
The arc() method in HTML5 Canvas creates circular arcs and full circles. The startAngle and endAngle parameters define which portion of the circle to draw, measured in radians from the positive x-axis. Syntax Following is the syntax for the arc() method − arc(x, y, radius, startAngle, endAngle, anticlockwise) Parameters The arc() method accepts the following parameters − x, y − Coordinates of the circle's center point radius − The radius of the circle in pixels startAngle − Starting angle in radians, measured from the positive x-axis endAngle − Ending angle in ...
Read MoreHTML 5 versus XHTML 1.0 Transitional
HTML5 and XHTML 1.0 Transitional are two different markup standards with distinct syntactic rules and capabilities. HTML5 is the latest evolution of HTML, offering modern elements and relaxed syntax rules, while XHTML 1.0 Transitional is an XML-based reformulation of HTML 4.01 with stricter syntax requirements. Key Differences HTML5 is based on SGML principles but uses a more flexible parsing model, while XHTML 1.0 Transitional strictly follows XML syntax rules. XHTML requires well-formed markup with proper element nesting, quoted attributes, and self-closing tags for empty elements. HTML5 vs XHTML 1.0 Transitional ...
Read MoreHow to count the number of occurrences of a character in a string in JavaScript?
There are several methods to count character occurrences in a JavaScript string. Here are the most effective approaches: Using a For Loop The traditional method uses a simple for loop to iterate through each character: function countCharacter(str, char) { let count = 0; for (let i = 0; i < str.length; i++) { ...
Read MoreHow to make an anchor tag refer to nothing?
To make an anchor tag refer to nothing, use javascript:void(0). The following link does nothing because the expression "0" has no effect in JavaScript. Here the expression "0" is evaluated, but it is not loaded back into the current document. Using javascript:void(0) The javascript:void(0) approach prevents the default link behavior and returns undefined, making the link inactive. Inactive Anchor Tag Click the following, This won't react at all... Click me! Alternative Methods There are ...
Read MoreDoes HTML5 allow you to interact with local client files from within a browser?
HTML5 allows web applications to interact with local client files through powerful APIs. These interfaces enable browsers to access the user's file system, read binary data, and handle file operations that were previously impossible with standard web technologies. HTML5 File APIs HTML5 provides three main APIs for file interaction: File API - Read file contents and metadata File System API - Access file system structure (deprecated in modern browsers) File Writer API - Write data to files (limited browser support) Reading Local Files The ...
Read More