C# Queryable Min Method

Ankith Reddy
Updated on 23-Jun-2020 08:14:53

59 Views

Get the minimum value from a sequence using the Min() method in C#.The following is our list.List list = new List { 1, 2, 3, 4, 5, 6 };Now, use Queryable Min() method to get minimum element.list.AsQueryable().Min();Exampleusing System; using System.Collections.Generic; using System.Linq; class Demo {    static void Main() {       List list = new List { 1, 2, 3, 4, 5, 6 };       foreach(long ele in list) {          Console.WriteLine(ele);       }       // getting lowest element       long min_num = list.AsQueryable().Min();       Console.WriteLine("Smallest number = {0}", mix_num);    } }

Which event occurs in JavaScript when the dragged element is over the target?

Paul Richard
Updated on 23-Jun-2020 08:14:21

257 Views

The ondragover event triggers when the dragged element is over the drop target.ExampleYou can try to run the following code to learn how to implement ondragover event in JavaScript −Live Demo                    .drag {             float: left;             width: 100px;             height: 35px;             border: 2px dashed #876587;             margin: 15px;             padding: 10px;          }   ... Read More

Remove an item from a Hashtable in C#

Ankith Reddy
Updated on 23-Jun-2020 08:13:54

505 Views

The following is our Hashtable −Hashtable h = new Hashtable(); h.Add(1, "Jack"); h.Add(2, "Henry"); h.Add(3, "Ben"); h.Add(4, "Chris");To remove an item, use the Remove() method. Here, we are removing the 3rd element.h.Remove(3);Let us see the complete example.Example Live Demousing System; using System.Collections; public class Demo {    public static void Main() {       Hashtable h = new Hashtable();       h.Add(1, "Jack");       h.Add(2, "Henry");       h.Add(3, "Ben");       h.Add(4, "Chris");       Console.WriteLine("Initial list:");       foreach (var key in h.Keys ) {          Console.WriteLine("Key = ... Read More

How to return the day of the week in the specified date according to universal time?

Akshaya Akki
Updated on 23-Jun-2020 08:13:52

57 Views

JavaScript date getUTCDay() method returns the day of the week in the specified date according to universal time. The value returned by getUTCDay() is an integer corresponding to the day of the week: 0 for Sunday, 1 for Monday, 2 for Tuesday, and so on.ExampleYou can try to run the following code to return the day of the week in the specified date −           JavaScript getUTCDay Method                        var dt = new Date( "January 15, 2018 20:15:20" );          document.write("getUTCDay() : " + dt.getUTCDay() );          

How to return the time-zone offset in minutes for the current locale?

Anvi Jain
Updated on 23-Jun-2020 08:13:23

171 Views

JavaScript date getTimezoneOffset() method returns the time-zone offset in minutes for the current locale. The time-zone offset is the minutes in difference; the Greenwich Mean Time (GMT) is relative to your local time.ExampleYou can try to run the following code to return the time-one offset in minutes −           JavaScript getTimezoneOffset Method                        var dt = new Date();          var tz = dt.getTimezoneOffset();                    document.write("getTimezoneOffset() : " + tz );          

C# Program to find a key in a Hashtable

karthikeya Boyini
Updated on 23-Jun-2020 08:13:17

352 Views

Set Hashtable collection with elements.Hashtable h = new Hashtable(); h.Add(1, "Jack"); h.Add(2, "Henry"); h.Add(3, "Ben"); h.Add(4, "Chris");Let’s say now you need to find any key, then use the Contains() method. We are finding key 3 here −h.Contains(3);The following is the complete example.Example Live Demousing System; using System.Collections; public class Demo {    public static void Main() {       Hashtable h = new Hashtable();       h.Add(1, "Jack");       h.Add(2, "Henry");       h.Add(3, "Ben");       h.Add(4, "Chris");       Console.WriteLine("Keys and Values list:");       foreach (var key in h.Keys ) ... Read More

C# Program to find a value in a Hashtable

George John
Updated on 23-Jun-2020 08:12:48

162 Views

Set Hahtable collection with elements.Hashtable h = new Hashtable(); h.Add(1, "Jack"); h.Add(2, "Henry"); h.Add(3, "Ben"); h.Add(4, "Chris");Let’s say now you need to find a value, then use the ContainsValue() method.We are finding value “Chris” here −h.ContainsValue(“Chris”);Example Live Demousing System; using System.Collections; public class Demo {    public static void Main() {       Hashtable h = new Hashtable();       h.Add(1, "Jack");       h.Add(2, "Henry");       h.Add(3, "Ben");       h.Add(4, "Chris");       Console.WriteLine("Keys and Values list:");       foreach (var key in h.Keys ) {          Console.WriteLine("Key ... Read More

What are the methods supported by W3C DOM?

Srinivas Gorla
Updated on 23-Jun-2020 08:12:46

43 Views

The following are the method supported by W3C DOM −Sr.NoProperty & Description1createAttribute( name)Returns a newly-created Attr node with the specified name.Ex − document.createAttribute( name)2createComment( text)Creates and returns a new Comment node containing the specified text.Ex − document.createComment( text)3createDocumentFragment( )Creates and returns an empty DocumentFragment node.Ex − document.createDocumentFragment( )4createElement( tagName)Creates and returns a new Element node with the specified tag name.Ex − document.createElement( tagName)5createTextNode( text)Creates and returns a new Text node that contains the specified text.Ex − document.createTextNode( text)6getElementById( id)Returns the Element of this document that has the specified value for its id attribute, or null if no such Element exists ... Read More

Convert.ToDouble Method in C#

Samual Sam
Updated on 23-Jun-2020 08:12:13

5K+ Views

To convert a specified value to a double-precision floating-point number, use Convert.ToDouble() method.The following is our long value −long[] val = { 340, -200};Now convert it to Double.double result; result = Convert.ToDouble(val);Example Live Demousing System; public class Demo {    public static void Main() {       long[] val = { 340, -200};       double result;       // long to double       foreach (long number in val) {          result = Convert.ToDouble(number);          Console.WriteLine("Converted {0} value to {1}",number, result);       }    } }OutputConverted 340 value to 340 Converted -200 value to -200

How to return the number of images in a document with JavaScript?

Samual Sam
Updated on 23-Jun-2020 08:12:05

693 Views

To return the number of images in a document, use the images property in JavaScript.ExampleYou can try to run the following code to get the count of images −Live Demo                                            var val = document.images.length;          document.write("Number of images in the document: "+val);          

Advertisements