Karthikeya Boyini has Published 2193 Articles

Basic calculator program using C#

karthikeya Boyini

karthikeya Boyini

Updated on 19-Jun-2020 08:24:03

1K+ Views

To create a calculator program in C#, you need to use Web Forms. Under that create buttons from 1-9, addition, subtraction, multiplication, etc.Let us see the code for addition, subtraction, and multiplication. Firstly, we have declared two variables −static float x, y;Now, we will see how to set codes for ... Read More

Bitwise right shift operators in C#

karthikeya Boyini

karthikeya Boyini

Updated on 19-Jun-2020 08:18:07

780 Views

Bitwise operator works on bits and performs bit by bit operation. In Bitwise right shift operator the value of the left operand is moved right by the number of bits specified by the right operand.In the below code, we have the value −60 i.e. 0011 1100On the right shift %minus;c ... Read More

Assertions in C#

karthikeya Boyini

karthikeya Boyini

Updated on 19-Jun-2020 08:14:00

2K+ Views

Assert statements are an effective way to catch program logic errors at runtime. It has two arguments −A boolean expression for a true condition, andWhat to display in case of false.Assertions are useful in large and complex programs to quickly flush out errors that generally arise when the code is ... Read More

Accessing Attributes and Methods in C#

karthikeya Boyini

karthikeya Boyini

Updated on 19-Jun-2020 08:12:55

414 Views

An attribute is a declarative tag that is used to convey information to runtime about the behaviors of various elements like classes, methods, structures, enumerators, assemblies etc. in your program. To set an attribute −[attribute(positional_parameters, name_parameter = value, ...)] ElementHere, the name of the attribute and values come inside [ ] ... Read More

Addition and Concatenation in C#

karthikeya Boyini

karthikeya Boyini

Updated on 19-Jun-2020 08:11:15

333 Views

To add and concatenate strings in C#, use the string. Concat method. The plus operator can also be used for the same purpose of concatenation.Plus Operatorstring str2 = "Hanks" + str1;ExampleLet us see an example of + operator to concatenate strings −Live Demousing System; class Program {    static ... Read More

Abstract vs Sealed Classes vs Class Members in C#

karthikeya Boyini

karthikeya Boyini

Updated on 19-Jun-2020 08:09:12

1K+ Views

The abstract class includes abstract and non-abstract methods. You cannot instantiate an abstract class.The sealed class prevents inheritance and you cannot use it as a base class.Abstract ClassesTo declare an abstract class, you need to place the keyword abstract before the class definition. An example of class members in an abstract ... Read More

Beginning C# programming with Hello World

karthikeya Boyini

karthikeya Boyini

Updated on 19-Jun-2020 07:51:01

642 Views

The following is a simple “Hello World” program in C# programming −ExampleLive Demousing System; namespace MyHelloWorldApplication {    class MyDemoClass {       static void Main(string[] args) {          // display text          Console.WriteLine("Hello World");          // display another text ... Read More

‘this’ keyword in C#

karthikeya Boyini

karthikeya Boyini

Updated on 19-Jun-2020 07:38:18

9K+ Views

The “this” keyword in C# is used to refer to the current instance of the class. It is also used to differentiate between the method parameters and class fields if they both have the same name.Another usage of “this” keyword is to call another constructor from a constructor in the ... Read More

Abstract Classes in C#

karthikeya Boyini

karthikeya Boyini

Updated on 19-Jun-2020 07:34:12

2K+ Views

An abstract class in C# includes abstract and non-abstract methods. A class is declared abstract to be an abstract class. You cannot instantiate an abstract class.Let us see an example, wherein we have an abstract class Vehicle and abstract method display()−public abstract class Vehicle {    public abstract void display(); ... Read More

Access Modifiers in C#

karthikeya Boyini

karthikeya Boyini

Updated on 19-Jun-2020 07:32:31

671 Views

Access Modifiers specifies the scope of variable and functions in C#. The following are the access modifiers used provided by C#:PublicThe public modifier sets no restriction on the access of members.ProtectedAccess limited to the derived class or class definition.InternalThe Internal access modifier access within the program that has its declaration.Protected ... Read More

Advertisements