C# Program to Convert Character Case

karthikeya Boyini
Updated on 19-Jun-2020 09:01:03

572 Views

Let’s say your string is −str = "AMIT";To convert the above uppercase string in lowercase, use the ToLower() method −Console.WriteLine("Converted to LowerCase : {0}", str.ToLower());ExampleThe following is the code in C# to convert character case.Live Demousing System; using System.Collections.Generic; using System.Text; namespace Demo {    class MyApplication {       static void Main(string[] args) {          string str;          str = "AMIT";          Console.WriteLine("UpperCase : {0}", str);          // convert to lowercase          Console.WriteLine("Converted to LowerCase : {0}", str.ToLower());          Console.ReadLine();       }    } }OutputUpperCase : AMIT Converted to LowerCase : amit

C# Bitwise and Bit Shift Operators

Samual Sam
Updated on 19-Jun-2020 09:00:12

3K+ Views

Bitwise operator works on bits and performs bit by bit operation.The Bitwise operators supported by C# are listed in the following table. Assume variable A holds 60 and variable B holds 13 −OperatorDescriptionExample&Bitwise AND Operator copies a bit to the result if it exists in both operands.(A & B) = 12, which is 0000 1100|Bitwise OR Operator copies a bit if it exists in either operand.(A | B) = 61, which is 0011 1101^Bitwise XOR Operator copies the bit if it is set in one operand but not both.(A ^ B) = 49, which is 0011 0001~Bitwise One's Complement Operator ... Read More

Debug JavaScript in Internet Explorer

Srinivas Gorla
Updated on 19-Jun-2020 08:59:04

210 Views

The most basic way to track down errors is by turning on error information in your browser. By default, Internet Explorer shows an error icon in the status bar when an error occurs on the page. Double-clicking this icon takes you to a dialog box showing information about the specific error that occurred. Since this icon is easy to overlook, Internet Explorer gives you the option to automatically show the Error dialog box whenever an error occurs. To enable this option, select Tools → Internet Options → Advanced tab. and then finally check the "Display a Notification About Every Script Error" box option as ... Read More

C# Example for Single Inheritance

karthikeya Boyini
Updated on 19-Jun-2020 08:58:59

4K+ Views

The following is an example of Single Inheritance in C#. In the example, the base class is Father and declared like the following code snippet −class Father {    public void Display() {       Console.WriteLine("Display");    } }Our derived class is Son and is declared below −class Son : Father {    public void DisplayOne() {       Console.WriteLine("DisplayOne");    } }ExampleThe following is the complete example to implement Single Inheritance in C#.Live Demousing System; using System.Collections.Generic; using System.Linq; using System.Text; namespace MyAplication {    class Demo {       static void Main(string[] args) {   ... Read More

C# Example for Multi-Level Inheritance

Samual Sam
Updated on 19-Jun-2020 08:58:22

5K+ Views

Multilevel Inheritance occurs when a derived class is formed from another derived class.Grandfather, father, and son are the perfect example to represent Multilevel Inheritance in C# −ExampleThe following is an example stating the usage of multilevel inheritance in C#.Live Demousing System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Demo {    class Son : Father {       public void DisplayTwo() {          Console.WriteLine("Son.. ");       }       static void Main(string[] args) {          Son s = new Son();          s.Display();          s.DisplayOne(); ... Read More

C# Factorial

Samual Sam
Updated on 19-Jun-2020 08:57:13

4K+ Views

To calculate factorial in C#, you can use while loop and loop through until the number is not equal to 1.Here n is the value for which you want the factorial −int res = 1; while (n != 1) {    res = res * n;    n = n - 1; }Above, let’s say we want 5! (5 factorial)For that, n=5, Loop Iteration 1 −n=5 res = res*n i.e res =5;Loop Iteration 2 −n=4 res = res*n i.e. res = 5*4 = 20Loop Iteration 3 −n=3 res = res*n i.e. res = 20*3 = 60ExampleIn this way, all the ... Read More

Basic Form Validation Using JavaScript

Vrundesha Joshi
Updated on 19-Jun-2020 08:56:24

741 Views

JavaScript provides a way to validate form's data on the client's computer before sending it to the web server. Basic form validation includes the form to be checked to make sure all the mandatory fields are filled in. It would require just a loop through each field in the form and check for data.ExampleYou can try to run the following code to implement basic form validation in JavaScript −           Form Validation                // Form validation          function validate(){             if( document.myForm.Name.value ... Read More

C# Generics vs C++ Templates

karthikeya Boyini
Updated on 19-Jun-2020 08:56:11

627 Views

C# Generics and C++ Templates provide support for parameterized types. The following are the differences −FlexibilityC++ Templates are more flexible than C# GenericsExplicit specializationExplicit specialization is not supported by C#Type ParameterThe type parameter cannot be used as the base class for the generic type in C#C# does not allow type parameters to have default types.Run-TimeThe C++ template has a compile-time modal, whereas C# Generics is both compile and run-time. Generics have run-time support.Non-type template parametersC#Templates will not allow non-type template parameters.Partial SpecializationC# does not even support partial specialization.

C# Language Advantages and Applications

Samual Sam
Updated on 19-Jun-2020 08:54:56

5K+ Views

C# is a modern, general-purpose, object-oriented programming language developed by Microsoft and approved by European Computer Manufacturers Association (ECMA) and International Standards Organization (ISO).C# is designed for Common Language Infrastructure (CLI), which consists of the executable code and runtime environment that allows the use of various high-level languages on different computer platforms and architectures.Advantages of C#Object-Oriented LanguageAutomatic Garbage CollectionCross PlatformBackward CompatibilityBetter Integrity and InteroperabilityApplications of C#Games using UnityWeb Applications Client-Server ApplicationsWindows Applications Applications that run on desktopsWeb Services ApplicationsConsole ApplicationsClass Libraries

What is onerror Method in JavaScript

Abhinaya
Updated on 19-Jun-2020 08:54:39

2K+ Views

The onerror event handler was the first feature to facilitate error handling in JavaScript. The error event is fired on the window object whenever an exception occurs on the page.ExampleYou can try to run the following code to implement onerror() method in JavaScript −                                         Click the following to see the result:                          

Advertisements