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
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"; }
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"; }
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
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
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
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
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
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
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"; } }
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP