Use the throw statement to raise your built-in exceptions or your customized exceptions. Later these exceptions can be captured and you can take appropriate action.ExampleYou can try to run the following code to implement throw statement − Click the following to see the result:
Set a LinkedList and add elements.string [] students = {"Beth", "Jennifer", "Amy", "Vera"}; LinkedList list = new LinkedList(students);Firstly, add a new node at the end.var newNode = list.AddLast("Emma");Now, use the AddAfter() method to add a node after the given node.list.AddAfter(newNode, "Matt");The following is the complete code.Example Live Demousing System; using System.Collections.Generic; class Demo { static void Main() { string [] students = {"Beth", "Jennifer", "Amy", "Vera"}; LinkedList list = new LinkedList(students); foreach (var stu in list) { Console.WriteLine(stu); } // ... Read More
To access document properties using Legacy DOM method in JavaScript, you can try to run the following code −Example Document Title This is main title Click the following to see the result:
Set two dates.DateTime date1 = new DateTime(2018, 7, 15, 08, 15, 20); DateTime date2 = new DateTime(2018, 8, 17, 11, 14, 25);Now, get the difference between two dates.TimeSpan ts = date2 - date1;Get the result i.e. the difference in hours.ts.TotalHoursLet us see the complete code.Example Live Demousing System; using System.Linq; public class Demo { public static void Main() { DateTime date1 = new DateTime(2018, 7, 15, 08, 15, 20); DateTime date2 = new DateTime(2018, 8, 17, 11, 14, 25); TimeSpan ts = date2 - date1; Console.WriteLine("No. of Hours (Difference) = {0}", ts.TotalHours); } }OutputNo. of Hours (Difference) = 794.984722222222
The Objects are organized in a hierarchy. This hierarchical structure applies to the organization of objects in a Web document.Window object − Top of the hierarchy. It is the utmost element of the object hierarchy.Document object − Each HTML document that gets loaded into a window becomes a document object. The document contains the contents of the page.Form object − Everything enclosed in the ... tags sets the form object.Form control elements − The form object contains all the elements defined for that object such as text fields, buttons, radio buttons, and checkboxes.The following is a simple hierarchy of a ... Read More
The following is the list of document methods supported by Legacy DOM −Sr.NoProperty & Description1clear( )Deprecated − Erases the contents of the document and returns nothing.Ex − document.clear( )2close( )Closes a document stream opened with the open( ) method and returns nothing.Ex − document.close( )3open( )Deletes existing document content and opens a stream to which new document contents may be written. Returns nothing.Ex − document.open( )4write( value, ...)Inserts the specified string or strings into the document currently being parsed or appends to document opened with open( ). Returns nothing.Ex − document.write( value, ...)5writeln( value, ...)Identical to write( ), except that ... Read More
The WindowHeight property gets or sets the height of the console window.Declare a variable.int height;Now, get the height of the current window.height = Console.WindowHeight;The following is the complete example −Example Live Demousing System; using System.Numerics; using System.Globalization; class Demo { static void Main() { int height; height = Console.WindowHeight; Console.WriteLine("Current window height = "+height); } }OutputCurrent window height = 0
Firstly, set the two dates.DateTime date1 = new DateTime(2018, 7, 15, 08, 15, 20); DateTime date2 = new DateTime(2018, 8, 17, 11, 14, 25);Now, calculate the difference between two dates.TimeSpan ts = date2 - date1;To calculate minutes.ts.TotalMinutesLet us see the complete code.Example Live Demousing System; using System.Linq; public class Demo { public static void Main() { DateTime date1 = new DateTime(2018, 7, 15, 08, 15, 20); DateTime date2 = new DateTime(2018, 8, 17, 11, 14, 25); TimeSpan ts = date2 - date1; Console.WriteLine("No. of Minutes (Difference) = {0}", ts.TotalMinutes); } }OutputNo. of Minutes (Difference) = 47699.0833333333
The following are the document properties which can be accessed using Legacy DOM −Sr.NoProperty & Description1alinkColorDeprecated − A string that specifies the color of activated links.Ex − document.alinkColor2anchors[ ]An array of Anchor objects, one for each anchor that appears in the documentEx − document.anchors[0], document.anchors[1] and so on3applets[ ]An array of Applet objects, one for each applet that appears in the documentEx − document.applets[0], document.applets[1] and so on4bgColorDeprecated − A string that specifies the background color of the document.Ex − document.bgColor5cookieA string-valued property with special behavior that allows the cookies associated with this document to be queried and set.Ex − ... Read More
Set two dates.DateTime date1 = new DateTime(2018, 7, 15, 08, 15, 20); DateTime date2 = new DateTime(2018, 7, 15, 11, 14, 25);Now calculate the difference between two dates.TimeSpan ts = date2 - date1;Move further and calculate the difference in seconds.ts.TotalSecondsLet us see the complete code.Example Live Demousing System; using System.Linq; public class Demo { public static void Main() { DateTime date1 = new DateTime(2018, 7, 15, 08, 15, 20); DateTime date2 = new DateTime(2018, 7, 15, 11, 14, 25); TimeSpan ts = date2 - date1; Console.WriteLine("No. of Seconds (Difference) = {0}", ts.TotalSeconds); } }OutputNo. of Seconds (Difference) = 10745
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP