Short Time 't' Format Specifier in C#

Samual Sam
Updated on 23-Jun-2020 07:03:57

493 Views

The Short Time format specifier represents a custom date and time format string.It is defined by the current DateTimeFormatInfo.ShortTimePattern property.For example, the custom format string is −HH:mmExample Live Demousing System; using System.Globalization; class Demo {    static void Main() {       DateTime date = new DateTime(2018, 5, 4, 10, 12, 10);       Console.WriteLine(date.ToString("t", CultureInfo.CreateSpecificCulture("en-us")));    } }Output10:12 AM

Reduce the Number of Errors in Scripts

Ramu Prasad
Updated on 23-Jun-2020 07:03:36

256 Views

To reduce the number of errors in scripts, follow the below-given tips −Use plenty of comments. Comments enable you to explain why you wrote the script the way you did and to explain particularly difficult sections of code.Always use indentation to make your code easy to read. Indenting statements also make it easier for you to match up the beginning and ending tags, curly braces, and other HTML and script elements.Write modular code. Whenever possible, group your statements into functions. Functions let you group related statements, and test and reuse portions of code with minimal effort.Be consistent in the way you ... Read More

Action Delegate in C#

George John
Updated on 23-Jun-2020 07:03:31

277 Views

Action delegate does not return a value and can be used with a method that has a void return type.Declare Action Delegate.Action del = Display;Here is our method −public static void Display(int val) {    Console.WriteLine(val); }Now call the method with a value.Example Live Demousing System; public class Demo {    public static void Main() {       Action del = Display;       del(2);    }    public static void Display(int val) {       Console.WriteLine(val);    } }Output2

Multiple Where Clause in C# LINQ

karthikeya Boyini
Updated on 23-Jun-2020 07:02:56

5K+ Views

Filter collections using Where clause in C#. A single query expression may have multiple where clauses.Firstly, set a collection −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, let’s use multiple ... Read More

Different Navigator Properties for Web Pages

Daniol Thomas
Updated on 23-Jun-2020 07:02:17

190 Views

can use several Navigator related properties in your Web page. The following are the properties −Sr.NoProperty & Description1appCodeNameThis property is a string that contains the code name of the browser, Netscape for Netscape and Microsoft Internet Explorer for Internet Explorer.2appVersionThis property is a string that contains the version of the browser as well as other useful information such as its language and compatibility.3languageThis property contains the two-letter abbreviation for the language that is used by the browser. Netscape only.4mimTypes[]This property is an array that contains all MIME types supported by the client. Netscape only.5platform[]This property is a string that contains ... Read More

Find Web Browser Name and Version with JavaScript

Abhinaya
Updated on 23-Jun-2020 07:01:42

349 Views

To find the name of the web browser, with version, you need to try the following code −Example           Browser Detection Example                                  

C# Queryable LongCount Method

Chandu yadav
Updated on 23-Jun-2020 07:01:10

207 Views

Use the Linq LongCount method to get the count of elements.The following is our string array −string[] emp = { "Jack", "Mark"};Now, use the LongCount() method.emp.AsQueryable().LongCount();Here is the complete code.Example Live Demousing System; using System.Collections.Generic; using System.Linq; class Demo {    static void Main() {       string[] emp = { "Jack", "Mark"};       long res = emp.AsQueryable().LongCount();       Console.WriteLine("{0} employees in the Department", res);    } }Output2 employees in the Department

Debug CSS and JavaScript Hover Issues

Rishi Rathor
Updated on 23-Jun-2020 06:59:35

512 Views

To debug CSS/JavaSript hover issues, you need to follow the below-given steps, Press F12 to open Inspect Element, in Firefox. In the DOM view right-click the element, and Select :hover, :active or :focus at the bottom of the context menuThe following screenshot shows how to debug hover issues −

Why is 'f' Required While Declaring Floats in C#

Arjun Thakur
Updated on 23-Jun-2020 06:59:13

811 Views

The f is a lowercase suffix set while declaring a float. It tells the compiler that the literal is of a specific type.Example Live Demousing System.IO; using System; public class Program {    public static void Main() {       float val = 30.22f;       Console.WriteLine(val);    } }Output30.22Above, we have set the float using f suffix.IEnumerable res = val1.AsQueryable().Intersect(val2);

Join, Sleep, and Abort Methods in C# Threading

Ankith Reddy
Updated on 23-Jun-2020 06:58:34

636 Views

JoinBlocks the calling thread until a thread terminates, while continuing to perform standard COM and SendMessage pumping. This method has different overloaded forms.SleepMakes the thread pause for a period of time.AbortThe Abort method is used to destroy threads.Let us see an example of Join() in threading −Exampleusing System; using System.Diagnostics; using System.Threading; namespace Sample {    class Demo {       static void Run() {          for (int i = 0; i < 2; i++)          Console.Write("Sample text!");       }       static void Main(string[] args) {       ... Read More

Advertisements