Differences Between Public, Protected, and Private Access Specifiers in C#

Samual Sam
Updated on 23-Jun-2020 12:20:52

3K+ Views

Public Access SpecifierPublic access specifier allows a class to expose its member variables and member functions to other functions and objects. Any public member can be accessed from outside the class.Example Live Demousing System; namespace Demo {    class Rectangle {       public double length;       public double width;       public double GetArea() {          return length * width;       }         public void Display() {          Console.WriteLine("Length: {0}", length);          Console.WriteLine("Width: {0}", width);          Console.WriteLine("Area: {0}", GetArea()); ... Read More

Set Item Growth Relative to Other JavaScript Elements

Priya Pallavi
Updated on 23-Jun-2020 12:20:37

110 Views

Use the flexGrow property to set how much the item will grow relative to the rest with JavaScript.ExampleYou can try to run the following code to learn how to work with flexGrow property −                    #box {             border: 1px solid #000000;             width: 250px;             height: 150px;             display: flex;             flex-flow: row wrap;          }          #box div {             flex-grow: 0;             flex-shrink: 1;             flex-basis: 20px;          }                              DIV1          DIV2          DIV3             Using flexGrow property       Set                function display() {             document.getElementById("myID").style.flexGrow = "2";          }          

Set Element's Display Type with JavaScript

Samual Sam
Updated on 23-Jun-2020 12:20:01

2K+ Views

To set an element’s display type, use the display property. If you want to hide the element, then use none.ExampleYou can try to run the following code to set an element's display type with JavaScript −Live Demo                    #myID {             width: 250px;             height: 200px;             background-color: green;          }                     Set display as none                Heading Level 1 for Demo          This is Demo Text. This is Demo Text. This is Demo Text. This is Demo Text.                      function display() {             document.getElementById("myID").style.display = "none";          }          

Set Style of Rule Between Columns with JavaScript

Fendadis John
Updated on 23-Jun-2020 12:19:00

147 Views

Use the columnRuleStyle property to set the style of the rule. You can try to run the following code to set the style of the rule between columns with JavaScript −ExampleLive Demo                    #myID {             column-count: 4;             column-rule: 4px dotted yellow;          }                     Click below to change style       Change Style between Columns                This ... Read More

Set Width of Rule Between Columns with JavaScript

Monica Mona
Updated on 23-Jun-2020 12:18:22

125 Views

Use the columnRuleWidth property to set the width between columns. You can try to run the following code to set the width of the rule between columns with JavaScript −ExampleLive Demo                    #myID {             column-count: 4;             column-rule: 4px solid yellow;          }                     Click below to change width       Change Width between Columns                This is ... Read More

Accessors of Properties in C#

Chandu yadav
Updated on 23-Jun-2020 12:18:13

918 Views

Properties are an extension of fields and are accessed using the same syntax. They use accessors through which the values of the private fields can be read, written or manipulated.The accessor of a property contains the executable statements that helps in getting (reading or computing) or setting (writing) the property.Let us see an example of properties in C#.ExampleDeclare a code property of type string.public string Code {    get {       return code;    }    set {       code = value;    } }In the same way, declare Age property of type as in the ... Read More

Add and Remove Methods in Chash Lists

karthikeya Boyini
Updated on 23-Jun-2020 12:17:39

1K+ Views

The List is a collection in C# and is a generic collection. The add and remove methods are used in C# lists for adding and removing elements.Let us see how to use Add() method in C#.Example Live Demousing System; using System.Collections.Generic; class Program {    static void Main() {       List sports = new List();       sports.Add("Football");       sports.Add("Tennis");       sports.Add("Soccer");       foreach (string s in sports) {          Console.WriteLine(s);       }    } }OutputFootball Tennis SoccerLet us see how to use Remove() method in C#.Example Live ... Read More

Set Column Width and Count with JavaScript

Vikyath Ram
Updated on 23-Jun-2020 12:16:55

782 Views

To set the column width and column count in a single declaration, use the JavaScript columns property.ExampleYou can try to run the following code to set column width and column count with JavaScript −                    #myID {             column-count: 4;             column-rule: 4px solid yellow;          }                     Click below to change the column count to 2 and minimum size       Change Column count and ... Read More

Possible Hash Array Initialization Syntaxes

Arjun Thakur
Updated on 23-Jun-2020 12:16:46

139 Views

Array can be initialized in more than one ways in C#. Let us see some example.Method OneUsing size of array.int [] marks = new int[5] { 99, 98, 92, 97, 95};Method TwoBy omitting the size.int [] marks = new int[] { 99, 98, 92, 97, 95};Method ThreeInitializing at the time of declaration.int [] marks = { 99, 98, 92, 97, 95};Let us see one of the ways to initialize arrays in C#.Example Live Demousing System; namespace Demo {    class MyArray {       static void Main(string[] args) {          int [] n = new int[10]; /* ... Read More

Set Length of Item Relative to Others with JavaScript

Abhinaya
Updated on 23-Jun-2020 12:16:12

140 Views

Use the flex property in JavaScript to set the length of the item relative to the rest. You can try to run the following code to implement flex property with JavaScript −Example                    #box {             border: 1px solid #000000;             width: 300px;             height: 400px;             display: flex;          }                              DIV1          DIV2          DIV3             Set                function display() {             var a = document.getElementById("box");             var b = a.getElementsByTagName("DIV");             var j ;             for (j = 0; j < b.length; j++) {                b[j].style.flex = "1";             }          }          

Advertisements