Set Style of Bottom Border with JavaScript

karthikeya Boyini
Updated on 23-Jun-2020 11:13:22

363 Views

To set the style of the bottom border, use the JavaScript borderBottomStyle property. It allows you to add a bottom border.ExampleYou can try to run the following code to set the style of the bottom border −           Demo Text             Click to set style of bottom border                function display() {             document.getElementById("box").style.borderBottomStyle = "dashed";          }          

Set All Four Border Radius Properties at Once with JavaScript

Lakshmi Srinivas
Updated on 23-Jun-2020 11:12:03

170 Views

To set all the border-radius properties in JavaScript, use the borderRadius property. Set the border-radius properties at once using this.ExampleYou can try to run the following code to learn how to set all the four border-radius properties −Live Demo                    #box {             border: thick solid gray;             width: 200px;             height: 200px          }                     Demo Text             Add border radius                function display() {             document.getElementById("box").style.borderRadius = "20px";          }          

Comparing Enum Members in C#

Chandu yadav
Updated on 23-Jun-2020 11:11:59

2K+ Views

To compare enum members, use the Enum.CompareTo() method.Firstly, set the values for students.enum StudentRank { Tom = 3, Henry = 2, Amit = 1 };Now use the compareTo() method to compare one enum value with another.Console.WriteLine( "{0}{1}", student1.CompareTo(student2) > 0 ? "Yes" : "No", Environment.NewLine );The following is the code to compare enum members in C#.Example Live Demousing System; public class Demo {    enum StudentRank { Tom = 3, Henry = 2, Amit = 1 };    public static void Main() {       StudentRank student1 = StudentRank.Tom;       StudentRank student2 = StudentRank.Henry;       StudentRank ... Read More

Purpose of is Operator in C#

karthikeya Boyini
Updated on 23-Jun-2020 11:10:37

255 Views

The "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#.Exampleusing 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");          x = (One)obj; ... Read More

Compressing and Decompressing Files in C#

Samual Sam
Updated on 23-Jun-2020 11:09:08

2K+ Views

Use the System.IO.Compression Namespace in C# to compress and decompress files in C#.CompressTo zip a file, use the GZipStream class with the FileStream class. Set the following parameters: File to be zipped and the name of the output zip file.Here, outputFile is the output file and the file is read into the FileStream.Exampleusing(var compress = new GZipStream(outputFile, CompressionMode.Compress, false)) {    byte[] b = new byte[inFile.Length];    int read = inFile.Read(b, 0, b.Length);    while (read > 0) {       compress.Write(b, 0, read);       read = inFile.Read(b, 0, b.Length);    } }DecompressTo decompress a file, use ... Read More

Set All Border Bottom Properties in One Declaration in JavaScript DOM

Lakshmi Srinivas
Updated on 23-Jun-2020 11:07:31

160 Views

To set the border bottom properties in one declaration in JavaScript, use the borderBottom property. It allows you to set the border-bottom-width, border-bottom-style, and border-bottom-color.ExampleYou can try to run the following code to learn how to set border bottom properties −Live Demo                    #box {             border: 2px dashed blue;             width: 120px;             height: 120px;          }                     Set border bottom color                Demo Text          Demo Text                      function display() {             document.getElementById("box").style.borderBottom = "thin dashed #000000";          }          

Set Border Width, Style, and Color in One Declaration with JavaScript

Paul Richard
Updated on 23-Jun-2020 11:06:22

992 Views

To set the border width, style, and color in a single declaration, use the border property in JavaScript.ExampleYou can try to run the following code to learn how to set border in JavaScript −Live Demo           Set border                Demo Text          Demo Text                      function display() {             document.getElementById("box").style.border = "thick dashed #000000";          }          

Compute Modulus Division by a Power of 2 in C#

Ankith Reddy
Updated on 23-Jun-2020 11:05:24

142 Views

We have taken the number as the following −uint a = 9; uint b = 8;Above, a is a divisor and b is dividend.To compute modulus division.Example Live Demousing System; class Demo {    static uint display( uint a, uint b) {       return ( a & (b-1) );    }    static public void Main () {       uint a = 9;       uint b = 6;       Console.WriteLine( a + " modulus " + b + " = " + display(a, b));    } }Output9 modulus 6 = 1

DivideByZeroException Class in C#

George John
Updated on 23-Jun-2020 11:04:53

979 Views

C# exceptions are represented by classes. The exception classes in C# are mainly directly or indirectly derived from the System.Exception class. Some of the exception classes derived from the System.Exception class are the System.ApplicationException and System.SystemException classes.System.DivideByZeroException is a class that handles errors generated from dividing a dividend with zero.Example Live Demousing System; namespace ErrorHandlingApplication {    class DivNumbers {       int result;       DivNumbers() {          result = 0;       }       public void division(int num1, int num2) {          try {         ... Read More

Const vs Static vs Readonly in C#

karthikeya Boyini
Updated on 23-Jun-2020 11:03:56

1K+ Views

ConstConstant fields are the fields that cannot be modified. At the time of declaration, you need to assign a value to it.const int a = 5;StaticIf the static modifier is applied to a class then you cannot instantiate the class using the new keyword. You can use the static keyword on methods, properties, classes, constructors, etc.static int a = 10;ReadonlyA Readonly field is initialized at the time of declaration or you can also set it within the constructor.Let us see an example in which the readonly field is initialized inside the constructor.Exampleclass Demo {    readonly int a;    public ... Read More

Advertisements