- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Set a LinkedList with nodes.string [] students = {"Tim", "Jack", "Henry", "David", "Tom"}; LinkedList list = new LinkedList(students);Now, use the AddLast() method to add a node at the last position.list.AddLast("Kevin");Here is the complete code with the updated LinkedList.Example Live Demousing System; using System.Collections.Generic; class Demo { static void Main() { string [] students = {"Tim", "Jack", "Henry", "David", "Tom"}; LinkedList list = new LinkedList(students); foreach (var stu in list) { Console.WriteLine(stu); } // adding a node at the end ... Read More
The operator is used in JavaScript to check whether a property is in an object or not.ExampleYou can try to run the following code to learn how to use in operator in JavaScript −Live Demo var emp = {name:"Amit", subject:"Java"}; document.write("name" in emp); document.write(""); document.write("subject" in emp); document.write(""); document.write("MAX_VALUE" in Number); document.write(""); document.write("MIN" in Number);
Use the Linq Average() method to find the average of a sequence of numeric values.Firstly, set a sequence.List list = new List { 5, 8, 13, 35, 67 };Now, use the Queryable Average() method to get the average.Queryable.Average(list.AsQueryable());Example Live Demousing System; using System.Linq; using System.Collections.Generic; class Demo { static void Main() { List list = new List { 5, 8, 13, 35, 67 }; double avg = Queryable.Average(list.AsQueryable()); Console.WriteLine("Average = "+avg); } }OutputAverage = 25.6
To find a character except for a newline, use the Metacharacter. (period). You can try to run the following code to find a character −Example JavaScript Regular Expression var myStr = "We provide websites! We provide content!"; var reg = /p.o/g; var match = myStr.match(reg); document.write(match);
Set query in a select clause using the into operator.The following is our list with Employee details −IList employee = new List() { new Employee() { EmpID = 1, EmpName = "Tom", EmpMarks = 90, Rank = 8} , new Employee() { EmpID = 2, EmpName = "Anne", EmpMarks = 60, Rank = 21 } , new Employee() { EmpID = 3, EmpName = "Jack", EmpMarks = 76, Rank = 18 } , new Employee() { EmpID = 4, EmpName = "Amy" , EmpMarks = 67, Rank = 20} , };Now, fetch employee name that ends ... Read More
To get information about the browser your webpage is currently running in, use the built-in navigator object. You can use various Navigator methods and properties with the object.ExampleYou can try to run the following code to implement Navigator object in JavaScript − Navigator Object Example
Javascript date setUTCMilliseconds() method sets the milliseconds for a specified date according to universal time.The following is the parameter for setUTCMilliseconds(millisecondsValue) −millisecondsValue − A number between 0 and 999, representing the milliseconds.ExampleYou can try to run the following code to set the milliseconds for a specified date according to universal time − JavaScript setUTCMilliseconds Method var dt = new Date( "Aug 28, 2008 23:30:00" ); dt.setUTCMilliseconds( 1200 ); document.write( dt );
Use the BufferHeight gets or sets the height of the buffer area.Use the property like this −Console.BufferHeightLet us see the complete example.Example Live Demousing System; class Demo { static void Main() { Console.WriteLine("Buffer height (rows) = "+Console.BufferHeight); } }OutputBuffer height (rows) = 0
Pad the beginning of the string with spaces using the PadLeft() method. You can also pad it with a Unicode character.Let’s say the following is our string.string myStr = "DemoOne";To set a padding at the beginning of the above string, use the PadLeft method.myStr.PadLeft(10);Here is the complete example.Example Live Demousing System; class Demo { static void Main() { string myStr = "DemoOne"; // set padding at the beginning Console.WriteLine(myStr.PadLeft(10)); myStr = "DemoTWO"; // set padding at the beginning Console.Write(myStr.PadLeft(15)); } }OutputDemoOne DemoTWO
We have a list without any element.List val = new List { };To display the default and avoid any error, use the FirstorDefault() method.val.AsQueryable().FirstOrDefault();You can also change the value to be displayed as default.Let us see the code.Example Live Demousing System; using System.Collections.Generic; using System.Linq; class Demo { static void Main() { List val = new List{ }; float a = val.AsQueryable().FirstOrDefault(); Console.WriteLine("Default Value = "+a); if (a == 0.0f) { a = 0.1f; } Console.WriteLine("Default Float value updated = "+a); } }OutputDefault Value = 0 Default Float value updated = 0.1