Giri Raju

Giri Raju

66 Articles Published

Articles by Giri Raju

66 articles

How to empty a C# list?

Giri Raju
Giri Raju
Updated on 17-Mar-2026 14K+ Views

To empty a C# list, use the Clear() method. This method removes all elements from the list and sets the count to zero. The Clear() method is the most efficient way to empty a list as it removes all elements in a single operation. Syntax Following is the syntax for the Clear() method − listName.Clear(); Parameters The Clear() method does not take any parameters. Return Value The Clear() method does not return any value. It modifies the list in-place by removing all elements. Using Clear() Method The following example ...

Read More

Global and Local Variables in C#

Giri Raju
Giri Raju
Updated on 17-Mar-2026 5K+ Views

In C#, variables are classified by their scope − the region of code where they can be accessed. The two main types are local variables (declared within methods) and global variables (which C# handles through static class members and namespace aliases). Local Variables A local variable is declared within a method, constructor, or block of code. Its scope is limited to that specific block, meaning it can only be accessed within the method or block where it was declared. Syntax dataType variableName; // or dataType variableName = value; Example using System; ...

Read More

Print number with commas as 1000 separators in C#

Giri Raju
Giri Raju
Updated on 17-Mar-2026 2K+ Views

In C#, you can format numbers with commas as thousand separators using various approaches. The most common and efficient methods involve using format strings with the ToString() method or composite formatting. Syntax Following is the syntax for formatting numbers with thousand separators − number.ToString("N") // Standard numeric format number.ToString("#, ##0.##") // Custom format with commas string.Format("{0:N}", number) // Composite formatting Using Standard Numeric Format ("N") The "N" format specifier automatically adds thousand separators and formats the number according to the current ...

Read More

Execute a script when the media has reached the end of HTML?

Giri Raju
Giri Raju
Updated on 16-Mar-2026 164 Views

The onended attribute in HTML executes a script when media playback reaches its natural end. This event is triggered for and elements when the media finishes playing, allowing you to display messages, suggest related content, or perform other actions. Syntax Following is the syntax for the onended attribute − ... ... The function() represents a JavaScript function that will execute when the media reaches its end. Video Element with onended Example Following example demonstrates the onended attribute with a video element − ...

Read More

Enable an extra set of restrictions for the content in an in HTML?

Giri Raju
Giri Raju
Updated on 16-Mar-2026 57 Views

The sandbox attribute in HTML enables an extra set of restrictions for the content loaded in an element. This attribute acts as a security feature that applies various limitations to the embedded content, preventing potentially harmful actions like form submissions, script execution, or navigation to other pages. The sandbox attribute provides a way to isolate iframe content and control what the embedded page can do, making it safer to embed third-party content on your website. Syntax Following is the syntax for the sandbox attribute − The sandbox attribute can be used ...

Read More

How to include an alternate text when the original element fails to display in HTML?

Giri Raju
Giri Raju
Updated on 16-Mar-2026 186 Views

The alt attribute provides alternative text for images when they cannot be displayed due to loading issues, broken links, or slow connections. This attribute is essential for accessibility, helping screen readers describe images to visually impaired users, and improves SEO by providing context to search engines. Syntax Following is the syntax for the alt attribute − The alt attribute accepts a text string that describes the image content or function. Keep the description concise but meaningful. Basic Alt Attribute Usage Example Following example shows how to use the alt attribute ...

Read More

Changing three.js background to transparent or another color in HTML

Giri Raju
Giri Raju
Updated on 16-Mar-2026 1K+ Views

In three.js, you can customize the background of your scene by making it transparent or setting it to a specific color. This is achieved through the WebGLRenderer configuration and the setClearColor method. Syntax Following is the syntax for creating a transparent background − var renderer = new THREE.WebGLRenderer({ alpha: true }); renderer.setClearColor(0x000000, 0); Following is the syntax for setting a background color − renderer.setClearColor(colorHex, alpha); Parameters The setClearColor method accepts the following parameters − colorHex − A hexadecimal color value (e.g., 0xff0000 for red) alpha − Opacity ...

Read More

How do we send an email using HTML forms?

Giri Raju
Giri Raju
Updated on 16-Mar-2026 58K+ Views

To send an email using HTML forms, you can use the mailto protocol in the form's action attribute. This method opens the user's default email client with pre-filled information from the form fields. However, this approach has significant limitations and is not recommended for production websites. Syntax Following is the basic syntax for using mailto in HTML forms − The enctype="text/plain" attribute ensures the form data is sent in a readable plain text format rather than URL-encoded format. Basic Email Form Example Following example demonstrates a ...

Read More

How to display a URL which explains the quote/deleted/inserted text in HTML?

Giri Raju
Giri Raju
Updated on 16-Mar-2026 151 Views

The cite attribute in HTML is used to specify a URL that explains the reason for quoting, deleting, or inserting text. This attribute provides additional context and reference information for the content, making it more accessible and informative for both users and search engines. Syntax Following is the syntax for the cite attribute − quoted text quoted content deleted text inserted text The cite attribute accepts a valid URL that points to a source document explaining the quote, deletion, or insertion. Elements That Support the Cite Attribute The cite attribute can be ...

Read More

Not showing a placeholder for input type="date" field with HTML5. How to solve it?

Giri Raju
Giri Raju
Updated on 16-Mar-2026 4K+ Views

HTML5 date inputs do not natively display placeholder text because the browser's date picker interface takes precedence. However, there are several techniques to provide placeholder-like guidance for users before they interact with the date field. Why Date Inputs Don't Show Placeholders The placeholder attribute is ignored on input type="date" because browsers render a specialized date picker widget that replaces the normal text input behavior. This creates a consistent date selection experience but removes the ability to show custom placeholder text. Method 1: Dynamic Type Switching This approach starts with a text input showing the placeholder, then ...

Read More
Showing 1–10 of 66 articles
« Prev 1 2 3 4 5 7 Next »
Advertisements