SlideShare a Scribd company logo
IndexersProperties. An index is identified by it's signatureBut a property is identified it's nameAn indexer is always an instance member, but a property can be static also. An indexer is accessed through an element accessBut a property is through a member accessDelegateInterfaceDeclaring a delegate   public delegate void ProcessBookDelegate(Book book);The specification defines a set of related methods that will be calledInstantiating a delegate   bookDB.ProcessPaperbackBooks(new ProcessBookDelegate(PrintTitle));Extension Methods inside .NET 3.5 I have just come across Extension Methods inside the new .NET framework and I have to say that they are very cool.  They allow you to extend most if not any type with custom functions which you specify.  The rule is that you must make the class which defines these methods as static, and a little new syntax, then away you go.So for this example what I did was create an interface called IKnownStringValidator, this interface has a property and one method which accepts the target string to be validated.Hide Code [-]     public interface IKnownStringValidator    {        string Pattern { get; }        bool Execute(string s);    }{..} Click Show Code I then created a class which inherits from this interface.  The class is called UKPostCodeValidator, and is simply so I can check for valid postcodes.  Nothing too special here and certainly nothing new.Hide Code [-] public class UKPostCodeValidator : IKnownStringValidator    {        const string m_pattern = \"
[a-zA-Z]{1,2}[0-9]{1,2}[\\s]?[0-9]{1,2}[a-zA-Z]{1,2}\"
;        #region IKnownStringValidator Members        public string Pattern        {            get            {                return m_pattern;            }        }        public bool Execute(string s)        {            System.Text.RegularExpressions.Regex r = new System.Text.RegularExpressions.Regex(m_pattern);            return r.Match(s).Success;        }        #endregion    }{..} Click Show Code OK, so now for the extension method.  I have called the class StringHelpers and of course this is a static class, and also any method which you define also must be static.  Notice the first argument of the class, it is the syntax to reference the calling instance of that specified type.  You can then reference this instance inside the function block by the named parameter.{..} Click Show Code {..} Click Show Code Calling a delegate   processBook(b); Hide Code [-]     public static class StringHelpers    {        public static bool ValidateString(this string s, IKnownStringValidator validator)        {            return validator.Execute(s);        }    }The implementation of this is where more new syntax and newly legalised code comes in.Hide Code [-]         protected override void OnLoad(EventArgs e)        {            base.OnLoad(e);            // The below variable b is set to true with the following statement            bool b = \"
WN5 8TJ\"
.ValidateString(new UKPostCodeValidator());        }Delegate and  EventsI have seen this used largely inside the MVC tutorials and examples where by developers are extending the HtmlHelper class.  One thing I did was make a quick and dirty function which allowed me to add an accesskey to the outputted anchor link.  I have not figured out the lambdas implementation yet so here is all I did.Hide Code [-]         public static string ActionLinkWithAccessKey(this System.Web.Mvc.HtmlHelper helper, string text, string action, string controller, string accesskey)        {            string format = \"
{2}\"
;            format = String.Format(format, \"
/\"
+controller + \"
/\"
 + action, accesskey, text);            return format;        }{..} Click Show Code With the implementation of this code being:public class MyClass{    public delegate void MyDelegate(string message);    public event MyDelegate MyEvent;    public void RaiseMyEvent(string msg)    {        if (MyEvent != null)            MyEvent(msg);    }}class Caller{    static void Main(string[] args)    {        MyClass myClass1 = new MyClass();        myClass1.MyEvent += new MyClass.MyDelegate(myClass1_MyEvent);        myClass1.RaiseMyEvent(\"
Hiii\"
);    }    //this method called only by MyDelegate    public static void myClass1_MyEvent(string message)    {        //do some thing to respond to the event here    }}Hide Code [-]  public class MyClass{    public delegate void MyDelegate(string message);    public event MyDelegate MyEvent;    public void RaiseMyEvent(string msg)    {        if (MyEvent != null)            MyEvent(msg);    }}class Caller{    static void Main(string[] args)    {        MyClass myClass1 = new MyClass();        myClass1.MyEvent += new MyClass.MyDelegate(myClass1_MyEvent);        myClass1.RaiseMyEvent(\"
Hiii\"
);    }    //this method called only by MyDelegate    public static void myClass1_MyEvent(string message)    {        //do some thing to respond to the event here    }}public class MyClass{    public delegate void MyDelegate(string message);    public event MyDelegate MyEvent;    public void RaiseMyEvent(string msg)    {        if (MyEvent != null)            MyEvent(msg);    }}class Caller{    static void Main(string[] args)    {        MyClass myClass1 = new MyClass();        myClass1.MyEvent += new MyClass.MyDelegate(myClass1_MyEvent);        myClass1.RaiseMyEvent(\"
Hiii\"
);    }    //this method called only by MyDelegate    public static void myClass1_MyEvent(string message)    {        //do some thing to respond to the event here    }}public class MyClass{    public delegate void MyDelegate(string message);    public event MyDelegate MyEvent;    public void RaiseMyEvent(string msg)    {        if (MyEvent != null)            MyEvent(msg);    }}class Caller{    static void Main(string[] args)    {        MyClass myClass1 = new MyClass();        myClass1.MyEvent += new MyClass.MyDelegate(myClass1_MyEvent);        myClass1.RaiseMyEvent(\"
Hiii\"
);    }    //this method called only by MyDelegate    public static void myClass1_MyEvent(string message)    {        //do some thing to respond to the event here    }}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 objectThe second parameter is an object derived from EventArgsEvents are properties of the class publishing the event. The keyword event controls how the event property is accessed by the subscribing classes.Abstract  ClassesInterfaceSome are abstract ,some may concrete.All the methods are abstractAn abstract class can have abstract members as well non-abstract membersBut in an interface all the members are implicitly abstract and all the members of the interface must override to its derived class.Abstract classes can have protected members, static membersThe members of the interface are public with no implementationAbstract classes are intended to be used base class. An abstract class cannot be instantiatedA non-abstract class derived from an abstract class must include actual implementations of all inherited abstract methods and accessors. Abstract and sealed (class cannot be inherited) modifier can’t work together.InheritancePolymorphismA class can be extending existing class & inheriting it's properties(attributes & behaviours).Ability of an object to have more than one forms which is direct result of inheritancethe propety that allows the reuse of an existing class to build a new classRuntime time polymorphism is done using inheritance and virtual functions. Method overriding is called runtime polymorphism. It is also called late bindingCompile time polymorphism is method and operators overloading. It is also called early binding.InternalProtectedInternal defines the scope with in the assembly andprotected defines the scope to the derived(sub) class.Internal means methods and properties will be accessible toClasses in the AssemblyProtected means methods and properties will be accessible toclasses and in the derived assemblyStored procedureUser defined functionsUDF can be used in the SQL statements anywhere in the WHERE/HAVING/SELECT section where as Stored procedures cannot be. Scalar-valued function-returns a scalar value such as an integer or a timestamp. Can be used as column name in queries Inline function-can contain a single SELECT statementTable-valued function-can contain any number of statements that populate the table variable to be returned. They become handy when you need to return a set of rows, but you can't enclose the logic for getting this rowset in a single SELECT statement.Extension methodsExtension methods are defined as static methods but are called by using instance method syntax. Their first parameter specifies which type the method operates on, and the parameter is preceded by the this modifier. Extension methods are only in scope when you explicitly import the namespace into your source code with a using directive.namespace ExtensionMethods{    public static class MyExtensions    {        public static int WordCount(this String str)        {            return str.Split(new char[] { ' ', '.', '?' }, StringSplitOptions.RemoveEmptyEntries).Length;        }    }   }using ExtensionMethods;string s = \"
Hello Extension Methods\"
;int i = s.WordCount();View stateControl stateA page developer can disable view state for the page or for an individual control for performance.control state cannot be disabled. Control state is designed for storing a control's essential data (such as a pager control's page number) that must be available on postback to enable the control to function even when view state has been disabled. By default, the ASP.NET page framework stores control state in the page in the same hidden element in which it stores view state. Even if view state is disabled, or when state is managed using Session, control state travels to the client and back to the server in the page. On postback, ASP.NET deserializes the contents of the hidden element and loads control state into each control that is registered for control state.Anonymous Types and Implicitly Typed Variablesvar dog = new { Breed = \"
Cocker Spaniel\"
,                               Coat = \"
black\"
, FerocityLevel = 1 };select top 10 cast(key as varchar)+ '(' + cast(count(key) as varchar) + ')' from TableNamegroup by keyWCFWEB SERVICEAddress --- Specifies the location of the service which will be like http://Myserver/MyService.Clients will use this location to communicate with our service. The development of web service with ASP.NET relies on defining data  and relies on the XmlSerializer to transform data to or from a service.Key issues with XmlSerializer to serialize .NET types to XML Binding --- Specifies how the two paries will communicate in term of transport and encoding and protocols  Only Public fields or Properties of .NET types can be translated into XML.   Only the classes which implement IEnumerable interface.Contract --- Specifies the interface between client and the server.It's a simple interface with some attributeClasses that implement the IDictionary interface, such as Hash table can not be serialized.The WCF uses the DataContractAttribute and DataMemeberAttribute to translate .NET FW types in to XML.XMLSerialization does not indicate the which fields or properties of the type are serialized into XML where as DataCotratSerializer Explicitly shows the which fields or properties are serialized into XML.WCF Service can be hosted within IIS or WindowsActivationService.Compile the service type into a class library Copy the service file with an extension .SVC into a virtual directory and assembly into bin sub directory of the virtual directory. Copy the web.config file into the virtual directory. ASP.NET web services are compiled into a class library assembly and a service file with an extension .asmx will have the code for the service. The service file is copied into the root of the ASP.NET application and Assembly will be copied to the bin directory. The application is accessible using url of the service file.Clients for the ASP.NET Web services are generated using the command-line tool WSDL.EXE.WCF uses the ServiceMetadata tool(svcutil.exe) to generate the client for the service.In ASP.NET Web services, Unhandled exceptions are returned to the client as SOAP faults.In WCF Services, unhandled exceptions are not returned to clients as SOAP faults. A configuration setting is provided to have the unhandled exceptions returned to clients for the purpose of debugging.CursorAdvantagesDisadvantagesCan do row vise validation from a table performance is lessCan fetch row wise records from a table every single row you retrieve will hit the server as a Single select query so performance will be low.Consumes more resourcesEfficiency: The query optimizer automatically selects theappropriate query plan, so the developer does not need todesign a complex algorithm to access the required data.Adaptability: As data changes or indexes are added ordropped, the query optimizer automatically adapts itsbehavior by using alternative plans. the ResultSet is less than 50 or 100 records it is better to go for implicit cursors. If the result set is large then you should use explicit cursors. Otherwise it will put Burdon on CPU.Fewer errors: Instead of the developer handling data andalgorithms in the application, the SQL Server Compact 3.5Database Engine natively supports the required operations. 1.Failing to check the value of @@Fetch_Status 2.Improper indexes on the base tables in your results set orFETCH statement 3.Too many columns being dragged around in memory, which arenever referenced in the subsequent cursor operations(probably the result of legacy code) 4.WHERE clause that brings too many rows into the cursor,Which are subsequently filtered out by cursor logic?Service Oriented ArchitectureSOA defines the interface in terms of protocols and functionality. An endpoint is the entry point to such an SOA implementation.requires loose coupling of services with operating systems, and other technologies that underlie applicationsService encapsulation – Many web services are consolidated to be used under the SOA. Often such services were not planned to be under SOA. Service loose coupling – Services maintain a relationship that minimizes dependencies and only requires that they maintain an awareness of each other.Service contract – Services adhere to a communications agreement, as defined collectively by one or more service description documents.Service abstraction – Beyond what is described in the service contract, services hide logic from the outside world.Service reusability – Logic is divided into services with the intention of promoting reuse.
Diifeerences In C#
Diifeerences In C#
Diifeerences In C#
Diifeerences In C#
Diifeerences In C#
Diifeerences In C#
Diifeerences In C#
Diifeerences In C#
Diifeerences In C#
Diifeerences In C#

More Related Content

PDF
JavaProgrammingManual
Naveen Sagayaselvaraj
 
PPSX
Oop features java presentationshow
ilias ahmed
 
PDF
Java Lab Manual
Naveen Sagayaselvaraj
 
DOCX
Rhino Mocks
Anand Kumar Rajana
 
DOC
Ad java prac sol set
Iram Ramrajkar
 
PPTX
Inheritance
Mavoori Soshmitha
 
PPTX
Easy mockppt
subha chandra
 
PPT
Executing Sql Commands
phanleson
 
JavaProgrammingManual
Naveen Sagayaselvaraj
 
Oop features java presentationshow
ilias ahmed
 
Java Lab Manual
Naveen Sagayaselvaraj
 
Rhino Mocks
Anand Kumar Rajana
 
Ad java prac sol set
Iram Ramrajkar
 
Inheritance
Mavoori Soshmitha
 
Easy mockppt
subha chandra
 
Executing Sql Commands
phanleson
 

What's hot (20)

PDF
Chain of responsibility
Achini Samuditha
 
PPT
Chapter 4 - Defining Your Own Classes - Part I
Eduardo Bergavera
 
PDF
C# Starter L06-Delegates, Event Handling and Extension Methods
Mohammad Shaker
 
PDF
Modul Praktek Java OOP
Zaenal Arifin
 
DOC
Advanced Java - Praticals
Fahad Shaikh
 
PDF
How and why I turned my old Java projects into a first-class serverless compo...
Mario Fusco
 
PPT
Chapter 7 - Defining Your Own Classes - Part II
Eduardo Bergavera
 
PPTX
Java Foundations: Methods
Svetlin Nakov
 
PDF
C# Delegates, Events, Lambda
Jussi Pohjolainen
 
PPT
Executing Sql Commands
leminhvuong
 
PPT
Call Back
leminhvuong
 
PDF
Advanced Java Practical File
Soumya Behera
 
PDF
Intake 38 5
Mahmoud Ouf
 
PDF
Pavel kravchenko obj c runtime
DneprCiklumEvents
 
PDF
C# Delegates and Event Handling
Jussi Pohjolainen
 
PPT
java tutorial 3
Tushar Desarda
 
PPT
JAVA CONCEPTS
Shivam Singh
 
PDF
FunctionalInterfaces
YourVirtual Class
 
PDF
C# Advanced L02-Operator Overloading+Indexers+UD Conversion
Mohammad Shaker
 
PDF
Csharp_Chap03
Mohamed Krar
 
Chain of responsibility
Achini Samuditha
 
Chapter 4 - Defining Your Own Classes - Part I
Eduardo Bergavera
 
C# Starter L06-Delegates, Event Handling and Extension Methods
Mohammad Shaker
 
Modul Praktek Java OOP
Zaenal Arifin
 
Advanced Java - Praticals
Fahad Shaikh
 
How and why I turned my old Java projects into a first-class serverless compo...
Mario Fusco
 
Chapter 7 - Defining Your Own Classes - Part II
Eduardo Bergavera
 
Java Foundations: Methods
Svetlin Nakov
 
C# Delegates, Events, Lambda
Jussi Pohjolainen
 
Executing Sql Commands
leminhvuong
 
Call Back
leminhvuong
 
Advanced Java Practical File
Soumya Behera
 
Intake 38 5
Mahmoud Ouf
 
Pavel kravchenko obj c runtime
DneprCiklumEvents
 
C# Delegates and Event Handling
Jussi Pohjolainen
 
java tutorial 3
Tushar Desarda
 
JAVA CONCEPTS
Shivam Singh
 
FunctionalInterfaces
YourVirtual Class
 
C# Advanced L02-Operator Overloading+Indexers+UD Conversion
Mohammad Shaker
 
Csharp_Chap03
Mohamed Krar
 
Ad

Viewers also liked (20)

PPTX
The rules of Ignite club
stephenlead
 
PPTX
Viral Marketing In Social Media By Tom Denegre
Denegre & Associates
 
PPT
Farzana More On The World
nurfarzana
 
PDF
Grow Marketing Capabilities
cqacathcart
 
PPTX
Proyecto De La Paz
guest11f14a
 
PPTX
Holiday wishes for 2010
designersgilde
 
PDF
Flyer
herehanx
 
PPT
Reunio Pares Tortugues
Cucaferatona
 
PDF
Microsoft power point novetats dia del llibre
Purabiblioteca
 
PPTX
CompañEros...
Angel
 
PPT
Jeopardy Civics CH 1
deanna devore
 
PPTX
Media base presentation creation
Rapporteuse
 
PDF
Let NY Work: A Common Agenda for the Common Good
Unshackle Upstate
 
PPT
110131 モバイル
Shouji Morimoto
 
PPT
Social Media Marketing
Larry Jennings
 
PDF
Virtual Humans in Cultural Heritage
guest456991
 
PDF
The Shadow
Sean Cubitt
 
PPTX
City Manager Presentation
The Development House
 
PPTX
AngkorWatMassTourism
jaenvit
 
The rules of Ignite club
stephenlead
 
Viral Marketing In Social Media By Tom Denegre
Denegre & Associates
 
Farzana More On The World
nurfarzana
 
Grow Marketing Capabilities
cqacathcart
 
Proyecto De La Paz
guest11f14a
 
Holiday wishes for 2010
designersgilde
 
Flyer
herehanx
 
Reunio Pares Tortugues
Cucaferatona
 
Microsoft power point novetats dia del llibre
Purabiblioteca
 
CompañEros...
Angel
 
Jeopardy Civics CH 1
deanna devore
 
Media base presentation creation
Rapporteuse
 
Let NY Work: A Common Agenda for the Common Good
Unshackle Upstate
 
110131 モバイル
Shouji Morimoto
 
Social Media Marketing
Larry Jennings
 
Virtual Humans in Cultural Heritage
guest456991
 
The Shadow
Sean Cubitt
 
City Manager Presentation
The Development House
 
AngkorWatMassTourism
jaenvit
 
Ad

Similar to Diifeerences In C# (20)

PPTX
Framework Design Guidelines For Brussels Users Group
brada
 
PPT
C# features
sagaroceanic11
 
PPT
Framework Design Guidelines
Mohamed Meligy
 
PPT
C#/.NET Little Wonders
BlackRabbitCoder
 
PPTX
Linq Introduction
Neeraj Kaushik
 
PPT
Chapter 1 Presentation
guest0d6229
 
PPTX
C# interview
Thomson Reuters
 
PPTX
Evolve Your Code
RookieOne
 
PPTX
SQL Saturday 28 - .NET Fundamentals
mikehuguet
 
PDF
Intake 38 5 1
Mahmoud Ouf
 
PPTX
Object Oriented Programming C#
Muhammad Younis
 
PPTX
06.1 .Net memory management
Victor Matyushevskyy
 
PPTX
Module 11 : Inheritance
Prem Kumar Badri
 
PPT
Object Oriented Programming In .Net
Greg Sohl
 
PPT
Delegates and Events in Dot net technology
ranjana dalwani
 
ODP
Can't Dance The Lambda
Togakangaroo
 
PDF
LectureNotes-02-DSA
Haitham El-Ghareeb
 
PDF
OOPS With CSharp - Jinal Desai .NET
jinaldesailive
 
PDF
C# Summer course - Lecture 3
mohamedsamyali
 
PPTX
C# Delegates
Raghuveer Guthikonda
 
Framework Design Guidelines For Brussels Users Group
brada
 
C# features
sagaroceanic11
 
Framework Design Guidelines
Mohamed Meligy
 
C#/.NET Little Wonders
BlackRabbitCoder
 
Linq Introduction
Neeraj Kaushik
 
Chapter 1 Presentation
guest0d6229
 
C# interview
Thomson Reuters
 
Evolve Your Code
RookieOne
 
SQL Saturday 28 - .NET Fundamentals
mikehuguet
 
Intake 38 5 1
Mahmoud Ouf
 
Object Oriented Programming C#
Muhammad Younis
 
06.1 .Net memory management
Victor Matyushevskyy
 
Module 11 : Inheritance
Prem Kumar Badri
 
Object Oriented Programming In .Net
Greg Sohl
 
Delegates and Events in Dot net technology
ranjana dalwani
 
Can't Dance The Lambda
Togakangaroo
 
LectureNotes-02-DSA
Haitham El-Ghareeb
 
OOPS With CSharp - Jinal Desai .NET
jinaldesailive
 
C# Summer course - Lecture 3
mohamedsamyali
 
C# Delegates
Raghuveer Guthikonda
 

Diifeerences In C#

  • 1. IndexersProperties. An index is identified by it's signatureBut a property is identified it's nameAn indexer is always an instance member, but a property can be static also. An indexer is accessed through an element accessBut a property is through a member accessDelegateInterfaceDeclaring a delegate   public delegate void ProcessBookDelegate(Book book);The specification defines a set of related methods that will be calledInstantiating a delegate   bookDB.ProcessPaperbackBooks(new ProcessBookDelegate(PrintTitle));Extension Methods inside .NET 3.5 I have just come across Extension Methods inside the new .NET framework and I have to say that they are very cool.  They allow you to extend most if not any type with custom functions which you specify.  The rule is that you must make the class which defines these methods as static, and a little new syntax, then away you go.So for this example what I did was create an interface called IKnownStringValidator, this interface has a property and one method which accepts the target string to be validated.Hide Code [-] public interface IKnownStringValidator { string Pattern { get; } bool Execute(string s); }{..} Click Show Code I then created a class which inherits from this interface.  The class is called UKPostCodeValidator, and is simply so I can check for valid postcodes.  Nothing too special here and certainly nothing new.Hide Code [-] public class UKPostCodeValidator : IKnownStringValidator { const string m_pattern = \" [a-zA-Z]{1,2}[0-9]{1,2}[\\s]?[0-9]{1,2}[a-zA-Z]{1,2}\" ; #region IKnownStringValidator Members public string Pattern { get { return m_pattern; } } public bool Execute(string s) { System.Text.RegularExpressions.Regex r = new System.Text.RegularExpressions.Regex(m_pattern); return r.Match(s).Success; } #endregion }{..} Click Show Code OK, so now for the extension method.  I have called the class StringHelpers and of course this is a static class, and also any method which you define also must be static.  Notice the first argument of the class, it is the syntax to reference the calling instance of that specified type.  You can then reference this instance inside the function block by the named parameter.{..} Click Show Code {..} Click Show Code Calling a delegate   processBook(b); Hide Code [-] public static class StringHelpers { public static bool ValidateString(this string s, IKnownStringValidator validator) { return validator.Execute(s); } }The implementation of this is where more new syntax and newly legalised code comes in.Hide Code [-] protected override void OnLoad(EventArgs e) { base.OnLoad(e); // The below variable b is set to true with the following statement bool b = \" WN5 8TJ\" .ValidateString(new UKPostCodeValidator()); }Delegate and EventsI have seen this used largely inside the MVC tutorials and examples where by developers are extending the HtmlHelper class.  One thing I did was make a quick and dirty function which allowed me to add an accesskey to the outputted anchor link.  I have not figured out the lambdas implementation yet so here is all I did.Hide Code [-] public static string ActionLinkWithAccessKey(this System.Web.Mvc.HtmlHelper helper, string text, string action, string controller, string accesskey) { string format = \" {2}\" ; format = String.Format(format, \" /\" +controller + \" /\" + action, accesskey, text); return format; }{..} Click Show Code With the implementation of this code being:public class MyClass{ public delegate void MyDelegate(string message); public event MyDelegate MyEvent; public void RaiseMyEvent(string msg) { if (MyEvent != null) MyEvent(msg); }}class Caller{ static void Main(string[] args) { MyClass myClass1 = new MyClass(); myClass1.MyEvent += new MyClass.MyDelegate(myClass1_MyEvent); myClass1.RaiseMyEvent(\" Hiii\" ); } //this method called only by MyDelegate public static void myClass1_MyEvent(string message) { //do some thing to respond to the event here }}Hide Code [-] public class MyClass{ public delegate void MyDelegate(string message); public event MyDelegate MyEvent; public void RaiseMyEvent(string msg) { if (MyEvent != null) MyEvent(msg); }}class Caller{ static void Main(string[] args) { MyClass myClass1 = new MyClass(); myClass1.MyEvent += new MyClass.MyDelegate(myClass1_MyEvent); myClass1.RaiseMyEvent(\" Hiii\" ); } //this method called only by MyDelegate public static void myClass1_MyEvent(string message) { //do some thing to respond to the event here }}public class MyClass{ public delegate void MyDelegate(string message); public event MyDelegate MyEvent; public void RaiseMyEvent(string msg) { if (MyEvent != null) MyEvent(msg); }}class Caller{ static void Main(string[] args) { MyClass myClass1 = new MyClass(); myClass1.MyEvent += new MyClass.MyDelegate(myClass1_MyEvent); myClass1.RaiseMyEvent(\" Hiii\" ); } //this method called only by MyDelegate public static void myClass1_MyEvent(string message) { //do some thing to respond to the event here }}public class MyClass{ public delegate void MyDelegate(string message); public event MyDelegate MyEvent; public void RaiseMyEvent(string msg) { if (MyEvent != null) MyEvent(msg); }}class Caller{ static void Main(string[] args) { MyClass myClass1 = new MyClass(); myClass1.MyEvent += new MyClass.MyDelegate(myClass1_MyEvent); myClass1.RaiseMyEvent(\" Hiii\" ); } //this method called only by MyDelegate public static void myClass1_MyEvent(string message) { //do some thing to respond to the event here }}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 objectThe second parameter is an object derived from EventArgsEvents are properties of the class publishing the event. The keyword event controls how the event property is accessed by the subscribing classes.Abstract ClassesInterfaceSome are abstract ,some may concrete.All the methods are abstractAn abstract class can have abstract members as well non-abstract membersBut in an interface all the members are implicitly abstract and all the members of the interface must override to its derived class.Abstract classes can have protected members, static membersThe members of the interface are public with no implementationAbstract classes are intended to be used base class. An abstract class cannot be instantiatedA non-abstract class derived from an abstract class must include actual implementations of all inherited abstract methods and accessors. Abstract and sealed (class cannot be inherited) modifier can’t work together.InheritancePolymorphismA class can be extending existing class & inheriting it's properties(attributes & behaviours).Ability of an object to have more than one forms which is direct result of inheritancethe propety that allows the reuse of an existing class to build a new classRuntime time polymorphism is done using inheritance and virtual functions. Method overriding is called runtime polymorphism. It is also called late bindingCompile time polymorphism is method and operators overloading. It is also called early binding.InternalProtectedInternal defines the scope with in the assembly andprotected defines the scope to the derived(sub) class.Internal means methods and properties will be accessible toClasses in the AssemblyProtected means methods and properties will be accessible toclasses and in the derived assemblyStored procedureUser defined functionsUDF can be used in the SQL statements anywhere in the WHERE/HAVING/SELECT section where as Stored procedures cannot be. Scalar-valued function-returns a scalar value such as an integer or a timestamp. Can be used as column name in queries Inline function-can contain a single SELECT statementTable-valued function-can contain any number of statements that populate the table variable to be returned. They become handy when you need to return a set of rows, but you can't enclose the logic for getting this rowset in a single SELECT statement.Extension methodsExtension methods are defined as static methods but are called by using instance method syntax. Their first parameter specifies which type the method operates on, and the parameter is preceded by the this modifier. Extension methods are only in scope when you explicitly import the namespace into your source code with a using directive.namespace ExtensionMethods{ public static class MyExtensions { public static int WordCount(this String str) { return str.Split(new char[] { ' ', '.', '?' }, StringSplitOptions.RemoveEmptyEntries).Length; } } }using ExtensionMethods;string s = \" Hello Extension Methods\" ;int i = s.WordCount();View stateControl stateA page developer can disable view state for the page or for an individual control for performance.control state cannot be disabled. Control state is designed for storing a control's essential data (such as a pager control's page number) that must be available on postback to enable the control to function even when view state has been disabled. By default, the ASP.NET page framework stores control state in the page in the same hidden element in which it stores view state. Even if view state is disabled, or when state is managed using Session, control state travels to the client and back to the server in the page. On postback, ASP.NET deserializes the contents of the hidden element and loads control state into each control that is registered for control state.Anonymous Types and Implicitly Typed Variablesvar dog = new { Breed = \" Cocker Spaniel\" , Coat = \" black\" , FerocityLevel = 1 };select top 10 cast(key as varchar)+ '(' + cast(count(key) as varchar) + ')' from TableNamegroup by keyWCFWEB SERVICEAddress --- Specifies the location of the service which will be like http://Myserver/MyService.Clients will use this location to communicate with our service. The development of web service with ASP.NET relies on defining data  and relies on the XmlSerializer to transform data to or from a service.Key issues with XmlSerializer to serialize .NET types to XML Binding --- Specifies how the two paries will communicate in term of transport and encoding and protocols Only Public fields or Properties of .NET types can be translated into XML.  Only the classes which implement IEnumerable interface.Contract --- Specifies the interface between client and the server.It's a simple interface with some attributeClasses that implement the IDictionary interface, such as Hash table can not be serialized.The WCF uses the DataContractAttribute and DataMemeberAttribute to translate .NET FW types in to XML.XMLSerialization does not indicate the which fields or properties of the type are serialized into XML where as DataCotratSerializer Explicitly shows the which fields or properties are serialized into XML.WCF Service can be hosted within IIS or WindowsActivationService.Compile the service type into a class library Copy the service file with an extension .SVC into a virtual directory and assembly into bin sub directory of the virtual directory. Copy the web.config file into the virtual directory. ASP.NET web services are compiled into a class library assembly and a service file with an extension .asmx will have the code for the service. The service file is copied into the root of the ASP.NET application and Assembly will be copied to the bin directory. The application is accessible using url of the service file.Clients for the ASP.NET Web services are generated using the command-line tool WSDL.EXE.WCF uses the ServiceMetadata tool(svcutil.exe) to generate the client for the service.In ASP.NET Web services, Unhandled exceptions are returned to the client as SOAP faults.In WCF Services, unhandled exceptions are not returned to clients as SOAP faults. A configuration setting is provided to have the unhandled exceptions returned to clients for the purpose of debugging.CursorAdvantagesDisadvantagesCan do row vise validation from a table performance is lessCan fetch row wise records from a table every single row you retrieve will hit the server as a Single select query so performance will be low.Consumes more resourcesEfficiency: The query optimizer automatically selects theappropriate query plan, so the developer does not need todesign a complex algorithm to access the required data.Adaptability: As data changes or indexes are added ordropped, the query optimizer automatically adapts itsbehavior by using alternative plans. the ResultSet is less than 50 or 100 records it is better to go for implicit cursors. If the result set is large then you should use explicit cursors. Otherwise it will put Burdon on CPU.Fewer errors: Instead of the developer handling data andalgorithms in the application, the SQL Server Compact 3.5Database Engine natively supports the required operations. 1.Failing to check the value of @@Fetch_Status 2.Improper indexes on the base tables in your results set orFETCH statement 3.Too many columns being dragged around in memory, which arenever referenced in the subsequent cursor operations(probably the result of legacy code) 4.WHERE clause that brings too many rows into the cursor,Which are subsequently filtered out by cursor logic?Service Oriented ArchitectureSOA defines the interface in terms of protocols and functionality. An endpoint is the entry point to such an SOA implementation.requires loose coupling of services with operating systems, and other technologies that underlie applicationsService encapsulation – Many web services are consolidated to be used under the SOA. Often such services were not planned to be under SOA. Service loose coupling – Services maintain a relationship that minimizes dependencies and only requires that they maintain an awareness of each other.Service contract – Services adhere to a communications agreement, as defined collectively by one or more service description documents.Service abstraction – Beyond what is described in the service contract, services hide logic from the outside world.Service reusability – Logic is divided into services with the intention of promoting reuse.