To sort an ArrayList in C#, use the Sort() method.The following is the ArrayList.ArrayList arr = new ArrayList(); arr.Add(32); arr.Add(12); arr.Add(55); arr.Add(8); arr.Add(13);Now the Sort() method is used to sort the ArrayList.arr.Sort();You can try to run the following code to sort an ArrayList in C#.Example Live Demousing System; using System.Collections; namespace Demo { class Program { static void Main(string[] args) { ArrayList arr = new ArrayList(); arr.Add(32); arr.Add(12); arr.Add(55); arr.Add(8); arr.Add(13); ... Read More
Use the pageBreakBefore property in JavaScript to set the page-break behavior before an element. Use the always property to insert a page break before an element.Note − The changes would be visible while printing or viewing the print preview.ExampleYou can try to run the following code to return the page-break behavior before an element with JavaScript − Heading 1 This is demo text. This is demo text. This if footer text. Set page-break function display() { document.getElementById("myFooter").style.pageBreakBefore = "always"; }
Use the left property to set the left position of a positioned element, such as a button.ExampleYou can try to run the following code to set the left position of a positioned element with JavaScript −Live Demo #myID { position: absolute; } Heading 1 This is Demo Text. Change Left Position function display() { document.getElementById("myID").style.left = "150px"; }
A class can be derived from more than one class or interface, which means that it can inherit data and functions from multiple base classes or interfaces.For example, Vehicle Base class with the following Derived Classes.Truck Bus MotobikeThe derived class inherits the base class member variables and member methods.In the same way, the derived class for Shape class can be Rectangle as in the following example.Example Live Demousing System; namespace Program { class Shape { public void setWidth(int w) { width = w; } public void setHeight(int ... Read More
For the Boolean type, the bool keyword is used and is an alias of System.Boolean.It is used to declare variables to store the Boolean values, true and false.Let us see an example to learn how to use bool in C#.Exampleusing System; public class Demo { static void Main() { bool val = true; int d = DateTime.Now.DayOfYear; val = (d % 2 == 0); if (val) { Console.WriteLine("days: even number"); } else { Console.WriteLine("days:odd number"); } } }
To create counters, use the counterReset property in JavaScript. You can try to run the following code to create or reset one or more counters with JavaScript −ExampleLive Demo h2:before { counter-increment: section; content: counter(section) " Quiz "; } Quizzes Change the counterIncrement Ruby Java PHP Perl Reset Counter function display() { document.body.style.counterReset = "section"; }
Here are some of the best JavaScript compressors available −Google Closure CompilerThe Google Closure compiler runs JavaScript quickly and used for a superior JavaScript. It parses your JavaScript, analyzes it, removes dead code, rewrites, and minimizes what's left.JSMinIf you want to minify, then use the JSMin to remove unnecessary comments.YUI CompressorThe YUI Compressor is used to minify the JavaScript files fastly and is secure.
Abstract classes contain abstract methods, which are implemented by the derived class. The derived classes have more specialized functionality.The following is an example showing the usage of abstract classes in C#.Example Live Demousing System; namespace Demo { abstract class Shape { public abstract int area(); } class Rectangle: Shape { private int length; private int width; public Rectangle( int a = 0, int b = 0) { length = a; width = b; Console.WriteLine("Length ... Read More
An implementation of the property accessors will not be provided by an abstract property declaration.Let us see how to learn how to work with abstract properties. Here we have an abstract class Shape with two derived classes: Square and Circle.Here, we have an abstract Area property.The following is the Circle class.Examplepublic class Circle : Shape { private int radius; public Circle(int radius, string id) : base(id) { this.radius = radius; } public override double Area { get { return radius * radius * System.Math.PI; ... Read More
Use the flexFlow property to set the flexible items to be visible in columns.ExampleYou can try to run the following code to make flexible items display in columns with JavaScript − #box { border: 1px solid #000000; width: 100px; height: 150px; display: flex; flex-flow: row wrap; } #box div { height: 40px; width: 40px; } DIV1 DIV2 DIV3 Using flexDirection property Set function display() { document.getElementById("box").style.flexFlow = "column nowrap"; }
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP