Giri Raju has Published 116 Answers

Print number with commas as 1000 separators in C#

Giri Raju
Published on 31-Aug-2018 12:01:18
Firstly, set the number as string −string num = "1000000.8765";Now, work around differently for number before and after the decimal −string withoutDecimals = num.Substring(0, num.IndexOf(".")); string withDecimals = num.Substring(num.IndexOf("."));Use the ToString() method to set the format for 1000 separators −ToString("#, ##0")The following is the complete code to display number with ... Read More

Global and Local Variables in C#

Giri Raju
Published on 31-Aug-2018 11:48:33
Local VariablesA local variable is used where the scope of the variable is within the method in which it is declared. They can be used only by statements that are inside that function or block of code.Example Live Demousing System; public class Program {    public static void Main() {   ... Read More

How to empty a C# list?

Giri Raju
Published on 31-Aug-2018 09:11:35
To empty a C# list, use the Clear() method.Firstly, set a list and add elements −List<string> myList = new List<string>() {    "one",    "two",    "three",    "four",    "five",    "six" };Now, let us empty the list −myList.Clear();Example Live Demousing System; using System.Collections.Generic; public class Program {    public ... Read More

Usage of rgba() CSS function

Giri Raju
Published on 07-Jun-2018 08:34:42
Use the CSS rgb() function to define color using the RGB Model.Use the CSS rgba() function to set RGB colors with opacity.You can try to run the following code to set color with rgba() function:ExampleLive Demo<!DOCTYPE html> <html>    <head>       <style>          h1 { ... Read More

CSS border-box Value

Giri Raju
Published on 16-May-2018 13:40:50
Use the CSS background-origin property to set the border-box value. With the border-box value, the background image begins from the upper left corner of the border.You can try to run the following code to implement the border-box value:ExampleLive Demo<!DOCTYPE html> <html>    <head>       <style>         ... Read More

How to work with CSS Transitions?

Giri Raju
Published on 16-May-2018 12:04:13
Use the transition property to work with CSS Transitions.You can try to run the following code to implement transitions in CSS:ExampleLive Demo<!DOCTYPE html> <html>    <head>       <style>          div {             width: 150px;             height: ... Read More

How to select elements with a specified attribute with CSS

Giri Raju
Published on 16-May-2018 11:17:49
To select elements with an attribute, use the CSS [attribute] selector.For example, alt attribute or a target attribute, etc.You can try to run the following code to implement the CSS[attribute] selector, ExampleLive Demo<!DOCTYPE html> <html>    <head>       <style>          img[alt] {       ... Read More

Set style to current link in a Navigation Bar with CSS

Giri Raju
Published on 09-May-2018 09:10:58
To set a style to current link in a navigation bar, add style to .active. You can try to run the following code to style current link:ExampleLive Demo<!DOCTYPE html> <html>    <head>       <style>          ul {             list-style-type: none; ... Read More

Role of CSS :link Selector

Giri Raju
Published on 08-May-2018 14:23:46
Use the CSS :link selector to style all unvisited links. You can try to run the following code to implement the :link selector −ExampleLive Demo<!DOCTYPE html> <html>    <head>       <style>          a:link {             background-color: orange;          } ... Read More

Style every checked <input> element with CSS

Giri Raju
Published on 08-May-2018 12:58:49
To style every checked <input> element, use the CSS :checked selector. You can try to run the following code to implement the :checked selector −ExampleLive Demo<!DOCTYPE html> <html>    <head>       <style>          input:checked {             height: 20px;       ... Read More
1 2 3 4 5 6 7 ... 12 Next
Advertisements