Basic information about C#

Basic information about C# Overview of C #.

Happy Maha Shivratri ... 🌹 🌹 हर हर महादेव 🌹 🌹
11/03/2021

Happy Maha Shivratri ...

🌹 🌹 हर हर महादेव 🌹 🌹

The Secrate Of Political Bargening Is To Look Stronger Than What You Really Are ... Subhas Chandra Bose...
23/01/2021

The Secrate Of Political Bargening Is To Look Stronger Than What You Really Are ...

Subhas Chandra Bose...

May This Year Bring New Happiness, New Goals, New Achievements, And a Lot of new Inspirations on Your Life. Wishing You ...
31/12/2020

May This Year Bring New Happiness, New Goals, New Achievements, And a Lot of new Inspirations on Your Life. Wishing You a Year Fully Loaded With Happiness.

System.Windows.Forms.Integration NamespaceContains classes that support interoperation of Windows Forms and WPF controls...
17/12/2020

System.Windows.Forms.Integration Namespace

Contains classes that support interoperation of Windows Forms and WPF controlsIn this article

Classes
Delegates
Remarks

Classes

CLASSESChildChangedEventArgs

Provides data for the ChildChanged and ChildChanged events.

A lambda expression is a convenient way of defining an anonymous (unnamed) function that can be passed around as a varia...
18/10/2020

A lambda expression is a convenient way of defining an anonymous (unnamed) function that can be passed around as a variable or as a parameter to a method call. ManyLINQ methods take a function (called a delegate) as a parameter.

A thread is defined as the ex*****on path of a program. Each thread defines a unique flow of control. If your applicatio...
23/08/2020

A thread is defined as the ex*****on path of a program. Each thread defines a unique flow of control. If your application involves complicated and time consuming operations, then it is often helpful to set different ex*****on paths or threads, with each thread performing a particular job.

Threads are lightweight processes. One common example of use of thread is implementation of concurrent programming by modern operating systems. Use of threads saves wastage of CPU cycle and increase efficiency of an application.

So far we wrote the programs where a single thread runs as a single process which is the running instance of the application. However, this way the application can perform one job at a time. To make it execute more than one task at a time, it could be divided into smaller threads.

Thread Life Cycle

The life cycle of a thread starts when an object of the System.Threading.Thread class is created and ends when the thread is terminated or completes ex*****on.

Following are the various states in the life cycle of a thread −

The Unstarted State − It is the situation when the instance of the thread is created but the Start method is not called.

The Ready State − It is the situation when the thread is ready to run and waiting CPU cycle.

The Not Runnable State − A thread is not executable, when

Sleep method has been calledWait method has been calledBlocked by I/O operations

The Dead State − It is the situation when the thread completes ex*****on or is aborted.

The Main Thread

In C #, the System.Threading.Thread class is used for working with threads. It allows creating and accessing individual threads in a multithreaded application. The first thread to be executed in a process is called the main thread.

When a C # program starts ex*****on, the main thread is automatically created. The threads created using the Thread class are called the child threads of the main thread. You can access a thread using the CurrentThread property of the Thread class.

Visual C # . NET includes a useful feature known as conditional compilation, which allows you to define methods that wil...
23/08/2020

Visual C # . NET includes a useful feature known as conditional compilation, which allows you to define methods that will be compiled when specific symbols are defined.Conditional compilation is commonly used with methods that are used only for debug builds.

Difference between Indexers and Properties Indexers :-1) Indexers are created with this keyword.Properties :-1) Properti...
23/08/2020

Difference between Indexers and Properties



Indexers :-
1) Indexers are created with this keyword.

Properties :-
1) Properties don't require this keyword.

Indexer :-
2)Indexers are identified by signature.

Properties :-
2) Properties are identified by their names.

Indexer :-
3) Indexers are accessed using indexes.

Properties :-
3) Properties are accessed by their names.

Indexer :-
4) Indexer are instance member, so can't be static.

Properties :-
4) Properties can be static as well as instance members.

Indexer :-
5) A get accessor of an indexer has the same formal parameter list as the indexer.

Properties :-
5) A get accessor of a property has no parameters.

Indexer :-
6) A set accessor of an indexer has the same formal parameter list as the indexer, in addition to the value parameter.

Properties :-
6) A set accessor of a property contains the implicit value parameter.

C # indexers are usually known as smart arrays. A C # indexer is a class property that allows you to access a member var...
23/08/2020

C # indexers are usually known as smart arrays. A C # indexer is a class property that allows you to access a member variable of a class or struct using the features of an array. In C #, indexers are created using this keyword. Indexers in C # are applicable on both classes and structs.


Defining an indexer allows you to create a class like that can allows its items to be accessed an array. Instances of that class can be accessed using the [] array access operator.



Creating an Indexer

this [argument list] { get { // your get block code } set { // your set block code } }

In the above code:





can be private, public, protected or internal.



can be any valid C # types.

this is a special keyword in C # to indicate the object of the current class.

The formal-argument-list specifies the parameters of the indexer.

Important points to remember on indexers:

Indexers are always created with this keyword.Parameterized property are called indexer.Indexers are implemented through get and set accessors for the [ ] operator.ref and out parameter modifiers are not permitted in indexer.The formal parameter list of an indexer corresponds to that of a method and at least one parameter should be specified.Indexer is an instance member so can't be static but property can be static.Indexers are used on group of elements.Indexer is identified by its signature where as a property is identified it's name.Indexers are accessed using indexes where as properties are accessed by names.Indexer can be overloaded.

Indexer are defined in pretty much same way as properties, with get and set functions. The main difference is that the name of the indexer is the keyword this.

Following program demonstrates how to use an indexer.

Generic is a class which allows the user to define classes and methods with the placeholder. Generics were added to vers...
23/08/2020

Generic is a class which allows the user to define classes and methods with the placeholder. Generics were added to version 2.0 of the C . The basic idea behind usingGeneric is to allow type (Integer, String, … etc and user-defined types) to be a parameter to methods, classes, and interfaces.

Generics allow you to define the specification of the data type of programming elements in a class or a method, until it is actually used in the program. In other words, generics allow you to write a class or method that can work with any data type.

-> Working with DelegatesIn essence, a delegate holds a reference to a method and also to the target object on which the...
22/08/2020

-> Working with Delegates

In essence, a delegate holds a reference to a method and also to the target object on which the method should be called. A delegate in C # is similar to function pointers of C++, but C # delegates are type safe. You can pass methods as parameters to a delegate to allow the delegate to point to the method. Delegates are used to define callback methods and implement event handling, and they are declared using the "delegate" keyword. You can declare a delegate that can appear on its own or even nested inside a class.

There are three steps in using delegates. These include: declaration, instantiation, and invocation.

The signature of a delegate looks like this:

Why new remote work policies attract hackers

delegate result-type identifier ([parameters])

The following statement shows how you can declare a delegate.

public delegate void MyDelegate(string text);

As you can see in the above statement, the delegate name is "MyDelegate" can it has a return type of "void" and it accepts a string object as argument. This implies that the delegate MyDelegate can point to a method that has identical signature. This is just a declaration though -- you should always instantiate a delegate before you can use it. The statement given next shows how you can instantiate the delegate declared above.

MyDelegate d = new MyDelegate(ShowText);

Once you have declared and instantiated the delegate, you can invoke the method that the delegate points to easily.

d("Hello World...");

Here, d is the delegate instance

You can also invoke the method that the delegate instance points to using the Invoke() method on the delegate instance as shown below.

d.Invoke("Hello World...");

If you have a method that accepts two numbers and you want to add them and return the sum of the two numbers, you can use a delegate to store the return value of the method as shown in the code snippet given below.

int result = d(12, 15);

Here's the complete code listing for your refer

Address

JAJMAU
Kanpur
208010

Opening Hours

Monday 9am - 5pm
Tuesday 4am - 5pm
Wednesday 4am - 5pm
Thursday 4am - 5pm
Friday 9am - 7am

Website

Alerts

Be the first to know and let us send you an email when Basic information about C# posts news and promotions. Your email address will not be used for any other purpose, and you can unsubscribe at any time.

Contact The Business

Send a message to Basic information about C#:

Share