Set an array.int[] arr = { 40, 42, 12, 83, 75, 40, 95 };Use the Where clause and predicate to get elements above 50.IEnumerable myQuery = arr.AsQueryable() .Where((a, index) => a >= 50);Let us see the complete code −Example Live Demousing System; using System.Linq; using System.Collections.Generic; public class Demo { public static void Main() { int[] arr = { 40, 42, 12, 83, 75, 40, 95 }; Console.WriteLine("Array:"); foreach (int a in arr) { Console.WriteLine(a); } // getting elements above 70 IEnumerable myQuery = arr.AsQueryable() .Where((a, index) => a >= 50); Console.WriteLine("Elements above 50...:"); foreach (int res in myQuery) { Console.WriteLine(res); } } }OutputArray: 40 42 12 83 75 40 95 Elements above 50...: 83 75 95
Convert a specified value to a decimal number using the Convert.ToDecimal() method.We have a string here.string stringVal = "2,345.26";Now, let us use the Convert.ToDecimal() method to convert it to a decimal number.decimal decimalVal; decimalVal = System.Convert.ToDecimal(stringVal);Let us now see the complete example −Example Live Demousing System; public class Demo { public static void Main() { decimal decimalVal; string stringVal = "2,345.26"; decimalVal = System.Convert.ToDecimal(stringVal); System.Console.WriteLine("String converted to decimal = {0} ", decimalVal); } }OutputString converted to decimal = 2345.26
Firstly, create a tuple as shown below that calls a method.var tuple = Show();The above statement calls the following method −static Tuple Show()Under the method, return the tuple as shown below −Example Live Demousing System; public class Demo { public static void Main() { var tuple = Show(); Console.WriteLine(tuple.Item1); Console.WriteLine(tuple.Item2); Console.WriteLine(tuple.Item3); Console.WriteLine(tuple.Item4); Console.WriteLine(tuple.Item5); } static Tuple Show() { return Tuple.Create(3, 5, 7, 9, 11); } }Output3 5 7 9 11
Firstly, set a tuplevar tuple = Tuple.Create(100, 200, 300);Now, pass the tuple as a method parameter −Show(tuple);Here’s our method.static void Show(Tuple tuple)Now call the tuple values one by one as shown below −Example Live Demousing System; public class Program { public static void Main() { var tuple = Tuple.Create(100, 200, 300); Show(tuple); } static void Show(Tuple tuple) { Console.WriteLine(tuple.Item1); Console.WriteLine(tuple.Item2); Console.WriteLine(tuple.Item3); } }Output100 200 300
The following is our array −double[] myArr = {20.5, 35.6, 45.7, 55.6, 79.7};To get the first element, use the First() method.myArr.AsQueryable().First();Let us see the complete code −Example Live Demousing System; using System.Linq; using System.Collections.Generic; class Demo { static void Main() { double[] myArr = {20.5, 35.6, 45.7, 55.6, 79.7}; double res = myArr.AsQueryable().First(); Console.WriteLine(res); } }Output20.5
The Date object is a datatype built into the JavaScript language. Date objects are created with the new Date( ) as shown below −new Date( ) new Date(milliseconds) new Date(datestring) new Date(year, month, date[, hour, minute, second, millisecond ])The following method is used to Manipulate Dates in JavaScript −Sr.NoMethod & Description1Date()Returns today's date and time2getDate()Returns the day of the month for the specified date according to local time.3getDay()Returns the day of the week for the specified date according to local time.4getFullYear()Returns the year of the specified date according to local time.5getHours()Returns the hour in the specified date according to local ... Read More
Use the Convert.ToInt64() method to convert Decimal to Int64 (long) in C#.Let’s say we have a decimal variable.decimal d = 310.23m;Now to convert it to Int64, use the Convert.ToInt64() method.long res; res = Convert.ToInt64(d);Let us see another example −Example Live Demousing System; class Demo { static void Main() { decimal d = 190.66m; long res; res = Convert.ToInt64(d); Console.WriteLine("Converted Decimal '{0}' to Int64 value {1}", d, res); } }OutputConverted Decimal '190.66' to Int64 value 191
To include optional function parameters in JavaScript, you can try the following,function myFunc(a, b = 0) { // function body }ExampleYou can try to run the following code to learn how to include optional function parameters − // default is set to 1 function inc(val1, inc = 1) { return val1 + inc; } document.write(inc(10,10)); document.write(""); document.write(inc(10));
To check if a JavaScript function is defined or not, checks it with “undefined”.ExampleYou can try to run the following example to check for a function is defined or not in JavaScript − function display() { alert("Demo Text!"); } if ( typeof(display) === 'undefined') { document.write('undefined'); } else { document.write("Function is defined"); }
To debug JavaScript in Visual Studio, follow the below-given steps −Open Visual StudioSelect your project to be debugged in Solution Explorer.Right Click and select Browse With, and set a default browser.Now, go to START and type Internet Options.Above, uncheck both the options for Disable script debugging.Click Apply, and then Ok.Now set breakpoints in your JS file.After that press the debug button in Visual Studio.
 
 Data Structure
 Data Structure Networking
 Networking RDBMS
 RDBMS Operating System
 Operating System Java
 Java MS Excel
 MS Excel iOS
 iOS HTML
 HTML CSS
 CSS Android
 Android Python
 Python C Programming
 C Programming C++
 C++ C#
 C# MongoDB
 MongoDB MySQL
 MySQL Javascript
 Javascript PHP
 PHP 
		 
		 
		 
		 
		 
		 
		 
		