SlideShare a Scribd company logo
1 of 13
iFour ConsultancyBasics of .Net
Constructor is a special method of a class which will invoke automatically when instance or object of class is created. Constructors are responsible for object
initialization and memory allocation of its class. If we create any class without constructor, the compiler will automatically create one default constructor for
that class. There is always at least one constructor in every class.
Basically constructors are 5 types those are
 Default Constructor
 Static Constructor
 Private Constructor
 Parameterized Constructor
 Copy Constructor
Example:
class SampleA
{
public SampleA()
{
Console.WriteLine("Sample A Test Method");
}
}
Constructor
http://www.ifourtechnolab.com Software development company india
A data type in a coding language is a set of data with values having predefined characteristics. Examples of data
types are: character, string, integer, floating point unit number, and pointer. Usually, a limited number of such data
types come built into a language. The language usually specifies the range of values for a given data type, how the
values are processed by the computer, and how they are stored.
Two types of Datatypes are present in .net Application
i. Reference type - The reference types do not contain the actual data stored in a variable, but
they contain a reference to the variables. n other words, they refer to a memory location.
Using multiple variables, the reference types can refer to a memory location. If the data in the
memory location is changed by one of the variables, the other variable automatically reflects
this change in value. Example of built-in reference types are: object, dynamic and string.
ii. Value type - Value type variables can be assigned a value directly. They are derived from the class
System.ValueType. The value types directly contain data. Some examples are char ,int, and float, which
stores numbers, alphabets, and floating point numbers, respectively. When you declare an int type, the
system allocates memory to store the value.
Data Types
Software development company indiahttp://www.ifourtechnolab.com
A control statement is a statement that determines whether other statements will be executed.
o An if statement decides whether to execute another statement, or decides which of two
statements to execute.
o A loop decides how many times to execute another statement. There are three kinds of loops:
o for loops are (typically) used to execute the controlled statement a given number of times.
o while loops test whether a condition is true before executing the controlled statement.
o do-while loops test whether a condition is true after executing the controlled statement.
o A switch statement decides which of several statements to execute.
Control statements
Software development company indiahttp://www.ifourtechnolab.com
Properties are as in everyday language and technically are fields of objects/classes with
dedicated getter/setter routines (which can be considered as methods. There are
languages that don't have properties and this behavior is achieved using a private field +
get/set methods.).
Methods ("member functions") are similar to functions, they belongs to classes or objects
and usually expresses the verbs of the objects/class. For example, an object of type
Window usually would have methods open and close which do corresponding operations
to the object they belong.
Properties and Methods
Software development company indiahttp://www.ifourtechnolab.com
 In .Net, a structure is a value type data type. It helps you to make a single variable hold related data of various data
types. The struct keyword is used for creating a structure. To define a structure, you must use the struct statement. The
struct statement defines a new data type, with more than one member for your program. Few Properties of structure
 Unlike classes, structures cannot inherit other structures or classes.
 Structures cannot be used as a base for other structures or classes.
 A structure can implement one or more interfaces.
 Structure members cannot be specified as abstract, virtual, or protected.
 classes are reference types and structs are value types
For example, here is the way you can declare the Book structure:
struct Books
{
public string title;
public string author;
public string subject;
public int book_id;
};
Structure
Software development company indiahttp://www.ifourtechnolab.com
An abstract class cannot be instantiated. The purpose of an abstract class is to provide a common definition
of a base class that multiple derived classes can share. For example, a class library may define an abstract
class that is used as a parameter to many of its functions, and require programmers using that library to
provide their own implementation of the class by creating a derived class.
Abstract methods have no implementation, so the method definition is followed by a semicolon instead of a
normal method block. Derived classes of the abstract class must implement all abstract methods. When an
abstract class inherits a virtual method from a base class, the abstract class can override the virtual method
with an abstract method.
Classes can be declared as abstract by putting the keyword abstract before the class definition. For example:
public abstract class A
{
// Class members here.
}
Abstract Classes
Software development company indiahttp://www.ifourtechnolab.com
An interface contains definitions for a group of related functionalities that a class or a struct can implement. The public definitions comprise the interface for the class,
which should never change, and a contract between the creator of the class and the users of the class. An interface looks like a class, but has no implementation. The
only thing it contains are declarations of events, indexers, methods and/or properties. The reason interfaces only provide declarations is because they are inherited by
classes and structs, which must provide an implementation for each interface member declared.
Defining an Interface:
interface IMyInterface
{
void MethodToImplement();
}
Using an Interface:
class InterfaceImplementer : IMyInterface
{
static void Main()
{
InterfaceImplementer iImp = new InterfaceImplementer();
iImp.MethodToImplement();
}
public void MethodToImplement()
{
Console.WriteLine("MethodToImplement() called.");
}
}
Interface
Software development company indiahttp://www.ifourtechnolab.com
Delegate and Event concepts are completely tied together. Delegates are just function pointers, That is, they hold references to
functions.
A Delegate is a class. When you create an instance of it, you pass in the function name (as a parameter for the delegate's
constructor) to which this delegate will refer.
Every delegate has a signature. For example:
delegate int SomeDelegate(string s, bool b);
The Event model in .net Languages finds its roots in the event programming model that is popular in asynchronous
programming. The basic foundation behind this programming model is the idea of "publisher and subscribers." In this model,
you have publishers who will do some logic and publish an "event." Publishers will then send out their event only to subscribers
who have subscribed to receive the specific event.
• The following important conventions are used with events:
• Event Handlers in the .NET Framework return void and take two parameters.
• The first paramter is the source of the event; that is the publishing object.
• The second parameter is an object derived from EventArgs.
• Events are properties of the class publishing the event.
• The keyword event controls how the event property is accessed by the subscribing classes.
Delegates and Events
Software development company indiahttp://www.ifourtechnolab.com
The More quoted word is Exception Handling and is defined as:
An exception is a problem that arises during the execution of a program. An exception is a response to an exceptional circumstance that arises
while a program is running, such as an attempt to divide by zero.
Exceptions provide a way to transfer control from one part of a program to another. C# exception handling is built upon four
keywords: try, catch, finally, and throw.
 try: A try block identifies a block of code for which particular exceptions is activated. It is followed by one or more catch blocks.
 catch: A program catches an exception with an exception handler at the place in a program where you want to handle the problem. The catch
keyword indicates the catching of an exception.
 finally: The finally block is used to execute a given set of statements, whether an exception is thrown or not thrown. For example, if you open
a file, it must be closed whether an exception is raised or not.
 throw: A program throws an exception when a problem shows up. This is done using a throw keyword.
Example:
try
{
// statements causing exception
}
catch( ExceptionName e1 ){ // error handling code}
catch( ExceptionName eN ){ // error handling code}
finally{ // statements to be executed }
Error Handling
Software development company indiahttp://www.ifourtechnolab.com
Static is a keyword which denotes things that are singular. They are part of no instance. Static often improves performance, but
makes programs less flexible. These are called with the type name. No instance is required—this makes them slightly faster.
Static methods can be public or private.
For Eg:
static class Perls
{
public static int value = 5;
}
It can be accessed directly by using Class For Eg: Perls.value which will return 5.
The virtual keyword is used to modify a method, property, indexer, or event declaration and allow for it to be overridden in a
derived class. For example, this method can be overridden by any class that inherits it. For Eg:
public virtual double Area()
{
return x * y;
}
Static and virtual Keyword
Software development company indiahttp://www.ifourtechnolab.com
In the common language runtime (CLR), the garbage collector serves as an automatic
memory manager. It provides the following benefits:
 Enables you to develop your application without having to free memory.
 Allocates objects on the managed heap efficiently.
 Reclaims objects that are no longer being used, clears their memory, and keeps the
memory available for future allocations. Managed objects automatically get clean
content to start with, so their constructors do not have to initialize every data field.
 Provides memory safety by making sure that an object cannot use the content of
another object.
Garbage Collection
Software development company indiahttp://www.ifourtechnolab.com
Thank you
Software development company indiahttp://www.ifourtechnolab.com

More Related Content

Viewers also liked

Using MongoDB with the .Net Framework
Using MongoDB with the .Net FrameworkUsing MongoDB with the .Net Framework
Using MongoDB with the .Net FrameworkStefano Paluello
 
Find out Which Versions of the .NET Framework are Installed on a PC.
Find out Which Versions of the .NET Framework are Installed on a PC.Find out Which Versions of the .NET Framework are Installed on a PC.
Find out Which Versions of the .NET Framework are Installed on a PC.raj upadhyay
 
ASP.NET Core, .NET Core e EF Core: multiplataforma e otimizados para a nuvem
ASP.NET Core, .NET Core e EF Core: multiplataforma e otimizados para a nuvemASP.NET Core, .NET Core e EF Core: multiplataforma e otimizados para a nuvem
ASP.NET Core, .NET Core e EF Core: multiplataforma e otimizados para a nuvemRogério Moraes de Carvalho
 
Using The .NET Framework
Using The .NET FrameworkUsing The .NET Framework
Using The .NET FrameworkLearnNowOnline
 
Inside .net framework
Inside .net frameworkInside .net framework
Inside .net frameworkFaisal Aziz
 
.net framework from 1.0 -> 4.0
.net framework from 1.0 -> 4.0.net framework from 1.0 -> 4.0
.net framework from 1.0 -> 4.0ligaoren
 
Dotnet Frameworks Version History
Dotnet Frameworks Version HistoryDotnet Frameworks Version History
Dotnet Frameworks Version Historyvoltaincx
 
Overview of .Net Framework 4.5
Overview of .Net Framework 4.5Overview of .Net Framework 4.5
Overview of .Net Framework 4.5Bhushan Mulmule
 
Introduction to .NET Programming
Introduction to .NET ProgrammingIntroduction to .NET Programming
Introduction to .NET ProgrammingKarthikeyan Mkr
 
Migrating To Visual Studio 2008 & .Net Framework 3.5
Migrating To Visual Studio 2008 & .Net Framework 3.5Migrating To Visual Studio 2008 & .Net Framework 3.5
Migrating To Visual Studio 2008 & .Net Framework 3.5Jeff Blankenburg
 
Visual Studio 2010 and .NET Framework 4.0 Overview
Visual Studio 2010 and .NET Framework 4.0 OverviewVisual Studio 2010 and .NET Framework 4.0 Overview
Visual Studio 2010 and .NET Framework 4.0 OverviewHarish Ranganathan
 
.NET Framework Overview
.NET Framework Overview.NET Framework Overview
.NET Framework OverviewDoncho Minkov
 

Viewers also liked (16)

Using MongoDB with the .Net Framework
Using MongoDB with the .Net FrameworkUsing MongoDB with the .Net Framework
Using MongoDB with the .Net Framework
 
Introduction of .net framework
Introduction of .net frameworkIntroduction of .net framework
Introduction of .net framework
 
Find out Which Versions of the .NET Framework are Installed on a PC.
Find out Which Versions of the .NET Framework are Installed on a PC.Find out Which Versions of the .NET Framework are Installed on a PC.
Find out Which Versions of the .NET Framework are Installed on a PC.
 
ASP.NET Core, .NET Core e EF Core: multiplataforma e otimizados para a nuvem
ASP.NET Core, .NET Core e EF Core: multiplataforma e otimizados para a nuvemASP.NET Core, .NET Core e EF Core: multiplataforma e otimizados para a nuvem
ASP.NET Core, .NET Core e EF Core: multiplataforma e otimizados para a nuvem
 
Using The .NET Framework
Using The .NET FrameworkUsing The .NET Framework
Using The .NET Framework
 
Inside .net framework
Inside .net frameworkInside .net framework
Inside .net framework
 
.Net framework
.Net framework.Net framework
.Net framework
 
.net framework from 1.0 -> 4.0
.net framework from 1.0 -> 4.0.net framework from 1.0 -> 4.0
.net framework from 1.0 -> 4.0
 
Dotnet Frameworks Version History
Dotnet Frameworks Version HistoryDotnet Frameworks Version History
Dotnet Frameworks Version History
 
Overview of .Net Framework 4.5
Overview of .Net Framework 4.5Overview of .Net Framework 4.5
Overview of .Net Framework 4.5
 
Introduction to .NET Programming
Introduction to .NET ProgrammingIntroduction to .NET Programming
Introduction to .NET Programming
 
Migrating To Visual Studio 2008 & .Net Framework 3.5
Migrating To Visual Studio 2008 & .Net Framework 3.5Migrating To Visual Studio 2008 & .Net Framework 3.5
Migrating To Visual Studio 2008 & .Net Framework 3.5
 
Dotnet basics
Dotnet basicsDotnet basics
Dotnet basics
 
Introduction to .NET Framework
Introduction to .NET FrameworkIntroduction to .NET Framework
Introduction to .NET Framework
 
Visual Studio 2010 and .NET Framework 4.0 Overview
Visual Studio 2010 and .NET Framework 4.0 OverviewVisual Studio 2010 and .NET Framework 4.0 Overview
Visual Studio 2010 and .NET Framework 4.0 Overview
 
.NET Framework Overview
.NET Framework Overview.NET Framework Overview
.NET Framework Overview
 

More from Jignesh Aakoliya

Understanding Web Services by software outsourcing company india
Understanding Web Services by software outsourcing company indiaUnderstanding Web Services by software outsourcing company india
Understanding Web Services by software outsourcing company indiaJignesh Aakoliya
 
Understanding CSS for web development by software outsourcing company india
Understanding CSS for web development by software outsourcing company indiaUnderstanding CSS for web development by software outsourcing company india
Understanding CSS for web development by software outsourcing company indiaJignesh Aakoliya
 
Overview of MVC Framework - by software outsourcing company india
Overview of MVC Framework - by software outsourcing company indiaOverview of MVC Framework - by software outsourcing company india
Overview of MVC Framework - by software outsourcing company indiaJignesh Aakoliya
 
Overview of entity framework by software outsourcing company india
Overview of entity framework by software outsourcing company indiaOverview of entity framework by software outsourcing company india
Overview of entity framework by software outsourcing company indiaJignesh Aakoliya
 
Overview of ASP.Net by software outsourcing company india
Overview of ASP.Net by software outsourcing company indiaOverview of ASP.Net by software outsourcing company india
Overview of ASP.Net by software outsourcing company indiaJignesh Aakoliya
 
Basics of html for web development by software outsourcing company india
Basics of html for web development   by software outsourcing company indiaBasics of html for web development   by software outsourcing company india
Basics of html for web development by software outsourcing company indiaJignesh Aakoliya
 

More from Jignesh Aakoliya (6)

Understanding Web Services by software outsourcing company india
Understanding Web Services by software outsourcing company indiaUnderstanding Web Services by software outsourcing company india
Understanding Web Services by software outsourcing company india
 
Understanding CSS for web development by software outsourcing company india
Understanding CSS for web development by software outsourcing company indiaUnderstanding CSS for web development by software outsourcing company india
Understanding CSS for web development by software outsourcing company india
 
Overview of MVC Framework - by software outsourcing company india
Overview of MVC Framework - by software outsourcing company indiaOverview of MVC Framework - by software outsourcing company india
Overview of MVC Framework - by software outsourcing company india
 
Overview of entity framework by software outsourcing company india
Overview of entity framework by software outsourcing company indiaOverview of entity framework by software outsourcing company india
Overview of entity framework by software outsourcing company india
 
Overview of ASP.Net by software outsourcing company india
Overview of ASP.Net by software outsourcing company indiaOverview of ASP.Net by software outsourcing company india
Overview of ASP.Net by software outsourcing company india
 
Basics of html for web development by software outsourcing company india
Basics of html for web development   by software outsourcing company indiaBasics of html for web development   by software outsourcing company india
Basics of html for web development by software outsourcing company india
 

Recently uploaded

Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 

Recently uploaded (20)

Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 

Basics of .net framework by software outsourcing company india

  • 2. Constructor is a special method of a class which will invoke automatically when instance or object of class is created. Constructors are responsible for object initialization and memory allocation of its class. If we create any class without constructor, the compiler will automatically create one default constructor for that class. There is always at least one constructor in every class. Basically constructors are 5 types those are  Default Constructor  Static Constructor  Private Constructor  Parameterized Constructor  Copy Constructor Example: class SampleA { public SampleA() { Console.WriteLine("Sample A Test Method"); } } Constructor http://www.ifourtechnolab.com Software development company india
  • 3. A data type in a coding language is a set of data with values having predefined characteristics. Examples of data types are: character, string, integer, floating point unit number, and pointer. Usually, a limited number of such data types come built into a language. The language usually specifies the range of values for a given data type, how the values are processed by the computer, and how they are stored. Two types of Datatypes are present in .net Application i. Reference type - The reference types do not contain the actual data stored in a variable, but they contain a reference to the variables. n other words, they refer to a memory location. Using multiple variables, the reference types can refer to a memory location. If the data in the memory location is changed by one of the variables, the other variable automatically reflects this change in value. Example of built-in reference types are: object, dynamic and string. ii. Value type - Value type variables can be assigned a value directly. They are derived from the class System.ValueType. The value types directly contain data. Some examples are char ,int, and float, which stores numbers, alphabets, and floating point numbers, respectively. When you declare an int type, the system allocates memory to store the value. Data Types Software development company indiahttp://www.ifourtechnolab.com
  • 4. A control statement is a statement that determines whether other statements will be executed. o An if statement decides whether to execute another statement, or decides which of two statements to execute. o A loop decides how many times to execute another statement. There are three kinds of loops: o for loops are (typically) used to execute the controlled statement a given number of times. o while loops test whether a condition is true before executing the controlled statement. o do-while loops test whether a condition is true after executing the controlled statement. o A switch statement decides which of several statements to execute. Control statements Software development company indiahttp://www.ifourtechnolab.com
  • 5. Properties are as in everyday language and technically are fields of objects/classes with dedicated getter/setter routines (which can be considered as methods. There are languages that don't have properties and this behavior is achieved using a private field + get/set methods.). Methods ("member functions") are similar to functions, they belongs to classes or objects and usually expresses the verbs of the objects/class. For example, an object of type Window usually would have methods open and close which do corresponding operations to the object they belong. Properties and Methods Software development company indiahttp://www.ifourtechnolab.com
  • 6.  In .Net, a structure is a value type data type. It helps you to make a single variable hold related data of various data types. The struct keyword is used for creating a structure. To define a structure, you must use the struct statement. The struct statement defines a new data type, with more than one member for your program. Few Properties of structure  Unlike classes, structures cannot inherit other structures or classes.  Structures cannot be used as a base for other structures or classes.  A structure can implement one or more interfaces.  Structure members cannot be specified as abstract, virtual, or protected.  classes are reference types and structs are value types For example, here is the way you can declare the Book structure: struct Books { public string title; public string author; public string subject; public int book_id; }; Structure Software development company indiahttp://www.ifourtechnolab.com
  • 7. An abstract class cannot be instantiated. The purpose of an abstract class is to provide a common definition of a base class that multiple derived classes can share. For example, a class library may define an abstract class that is used as a parameter to many of its functions, and require programmers using that library to provide their own implementation of the class by creating a derived class. Abstract methods have no implementation, so the method definition is followed by a semicolon instead of a normal method block. Derived classes of the abstract class must implement all abstract methods. When an abstract class inherits a virtual method from a base class, the abstract class can override the virtual method with an abstract method. Classes can be declared as abstract by putting the keyword abstract before the class definition. For example: public abstract class A { // Class members here. } Abstract Classes Software development company indiahttp://www.ifourtechnolab.com
  • 8. An interface contains definitions for a group of related functionalities that a class or a struct can implement. The public definitions comprise the interface for the class, which should never change, and a contract between the creator of the class and the users of the class. An interface looks like a class, but has no implementation. The only thing it contains are declarations of events, indexers, methods and/or properties. The reason interfaces only provide declarations is because they are inherited by classes and structs, which must provide an implementation for each interface member declared. Defining an Interface: interface IMyInterface { void MethodToImplement(); } Using an Interface: class InterfaceImplementer : IMyInterface { static void Main() { InterfaceImplementer iImp = new InterfaceImplementer(); iImp.MethodToImplement(); } public void MethodToImplement() { Console.WriteLine("MethodToImplement() called."); } } Interface Software development company indiahttp://www.ifourtechnolab.com
  • 9. Delegate and Event concepts are completely tied together. Delegates are just function pointers, That is, they hold references to functions. A Delegate is a class. When you create an instance of it, you pass in the function name (as a parameter for the delegate's constructor) to which this delegate will refer. Every delegate has a signature. For example: delegate int SomeDelegate(string s, bool b); The Event model in .net Languages finds its roots in the event programming model that is popular in asynchronous programming. The basic foundation behind this programming model is the idea of "publisher and subscribers." In this model, you have publishers who will do some logic and publish an "event." Publishers will then send out their event only to subscribers who have subscribed to receive the specific event. • The following important conventions are used with events: • Event Handlers in the .NET Framework return void and take two parameters. • The first paramter is the source of the event; that is the publishing object. • The second parameter is an object derived from EventArgs. • Events are properties of the class publishing the event. • The keyword event controls how the event property is accessed by the subscribing classes. Delegates and Events Software development company indiahttp://www.ifourtechnolab.com
  • 10. The More quoted word is Exception Handling and is defined as: An exception is a problem that arises during the execution of a program. An exception is a response to an exceptional circumstance that arises while a program is running, such as an attempt to divide by zero. Exceptions provide a way to transfer control from one part of a program to another. C# exception handling is built upon four keywords: try, catch, finally, and throw.  try: A try block identifies a block of code for which particular exceptions is activated. It is followed by one or more catch blocks.  catch: A program catches an exception with an exception handler at the place in a program where you want to handle the problem. The catch keyword indicates the catching of an exception.  finally: The finally block is used to execute a given set of statements, whether an exception is thrown or not thrown. For example, if you open a file, it must be closed whether an exception is raised or not.  throw: A program throws an exception when a problem shows up. This is done using a throw keyword. Example: try { // statements causing exception } catch( ExceptionName e1 ){ // error handling code} catch( ExceptionName eN ){ // error handling code} finally{ // statements to be executed } Error Handling Software development company indiahttp://www.ifourtechnolab.com
  • 11. Static is a keyword which denotes things that are singular. They are part of no instance. Static often improves performance, but makes programs less flexible. These are called with the type name. No instance is required—this makes them slightly faster. Static methods can be public or private. For Eg: static class Perls { public static int value = 5; } It can be accessed directly by using Class For Eg: Perls.value which will return 5. The virtual keyword is used to modify a method, property, indexer, or event declaration and allow for it to be overridden in a derived class. For example, this method can be overridden by any class that inherits it. For Eg: public virtual double Area() { return x * y; } Static and virtual Keyword Software development company indiahttp://www.ifourtechnolab.com
  • 12. In the common language runtime (CLR), the garbage collector serves as an automatic memory manager. It provides the following benefits:  Enables you to develop your application without having to free memory.  Allocates objects on the managed heap efficiently.  Reclaims objects that are no longer being used, clears their memory, and keeps the memory available for future allocations. Managed objects automatically get clean content to start with, so their constructors do not have to initialize every data field.  Provides memory safety by making sure that an object cannot use the content of another object. Garbage Collection Software development company indiahttp://www.ifourtechnolab.com
  • 13. Thank you Software development company indiahttp://www.ifourtechnolab.com

Editor's Notes

  1. Software development company india – http://www.ifourtechnolab.com
  2. Software development company india – http://www.ifourtechnolab.com
  3. Software development company india – http://www.ifourtechnolab.com
  4. Software development company india – http://www.ifourtechnolab.com
  5. Software development company india – http://www.ifourtechnolab.com
  6. Software development company india – http://www.ifourtechnolab.com
  7. Software development company india – http://www.ifourtechnolab.com
  8. Software development company india – http://www.ifourtechnolab.com
  9. Software development company india – http://www.ifourtechnolab.com
  10. Software development company india – http://www.ifourtechnolab.com
  11. Software development company india – http://www.ifourtechnolab.com
  12. Software development company india – http://www.ifourtechnolab.com
  13. Software development company india – http://www.ifourtechnolab.com