SlideShare a Scribd company logo
1 of 23
Collection
A collection is a group of objects
Collection
• A collection is a group of objects. The
.NET Framework contains a large number
of interfaces and classes that define and
implement various types of collections.
• Originally, there were only non-generic
collection classes.
Collection
• The principal benefit of collections is that they
standardize the way groups of objects are
handled by your programs.
• All collections are designed around a set of
cleanly defined interfaces. Several built-in
implementations of these interfaces, such as
ArrayList, Hashtable, Stack, and Queue, are
provided, which you can use as-is.
• The .NET Framework supports five general
types of collections: non-generic, specialized,
bit-based, generic, and concurrent.
non-generic
• The non-generic collections have been part of the .NET
Framework since version 1.0.
• They are defined in the System.Collections
namespace.
• The non-generic collections are general-purpose data
structures that operate on object references.
• Thus, they can manage any type of object, but not in a
type-safe manner.
• you can mix various types of data within the same
collection.
• non-generic collections do not have the type-safety that
is found in the generic collections.
• The non-generic collections implement several
fundamental data structures, including a dynamic array,
stack, and queue.
• They also include dictionaries, in which you can store
key/value pairs.
Specialized Collections
• The specialized collections operate on a specific type of
data or operate in a unique way.
• For example, there are specialized collections for
strings.
• The specialized collections are declared in
System.Collections.Specialized.
• Specialized Collection:-HybridDictionary, ListDictionary,
NameValueCollection, StringDictionary etc.
• System.Collections also defines three abstract base
classes, CollectionBase, ReadOnlyCollectionBase, and
DictionaryBase, which can be inherited and used.
Bit-based
• The Collections API defines one bit-based
collection called BitArray class.
• BitArray supports bitwise operations on bits,
such as AND and XOR.
• BitArray is declared in System.Collections.
• it still supports the basic collection underpinning
by implementing ICollection and IEnumerable.
• You can construct a BitArray from an array of
Boolean values using this constructor:
• public BitArray(bool[ ] values)
Generic Collection
•
•
•
•
•
•

The generic collections provide generic implementations of several
standard data structures, such as linked lists, stacks, queues, and
dictionaries.
Because these collections are generic, they are type-safe.
This means that only items that are type-compatible with the type of
the collection can be stored in a generic collection, thus eliminating
accidental type mismatches.
Generic collections are declared in System.Collections.Generic
namespace.
There is a generic collection called LinkedList that implements a
doubly linked list, but no non-generic equivalent.

The generic collections work in the same way as the non-generic
collections with the exception that a generic collection is type-safe.
• For all cases in which a collection is storing only one type of
object, then a generic collection is your best choice
Concurrent Collection
• The .NET Framework version 4.0 adds a new
namespace called
System.Collections.Concurrent.
• It contains collections that are thread-safe and
designed to be used for parallel programming.
• The concurrent collections support
multithreaded access to a collection.
• Concurrent Collection:-BlockingCollection<T>,
ConcurrentDictionary<TKey, TValue> etc.
Next…..
Handling Network Errors
• To handle network exceptions that the program
might generate, you must monitor calls to
Create( ), GetResponse( ), and
GetResponseStream( ).
• It is important to understand that the exceptions
that can be generated depend upon the protocol
being used.
• The following discussion describes several of
the exceptions possible when using HTTP.
Exceptions Generated by Create( )
• The Create( ) method defined by WebRequest it can
generate four exceptions.
• If the protocol specified by the URI prefix is not
supported, then NotSupportedException is thrown.
• If the URI format is invalid, UriFormatException is
thrown.
• If the user does not have the proper authorization, a
System.Security.SecurityException will be thrown.
• Create( ) can also throw an ArgumentNullException if
it is called with a null reference, but this is not an error
generated by networking.

• WebRequest.Create("http://www.McGrawHill.com")
Exceptions Generated by
GetReponse( )
•

A number of errors can occur when obtaining an HTTP response by
calling GetResponse( ).

•

These are represented by the following exceptions:
InvalidOperationException, ProtocolViolationException,
NotSupportedException, and WebException. Of these, the one of
most interest is WebException.

•

WebException has two properties that relate to network errors:
Response and Status.
• You can obtain a reference to the WebResponse object inside an
exception handler through the Response property.
• When an error occurs, you can use the Status property of
WebException to find out what went wrong.
Exceptions Generated by
GetResponseStream( )
• For the HTTP protocol, the GetResponseStream( )
method of WebResponse can throw a
ProtocolViolationException, which, in general, means
that some error occurred relative to the specified
protocol.
• As it relates to GetResponseStream( ), it means that no
valid response stream is available.
• An ObjectDisposedException will be thrown if the
response has already been disposed.
• Of course, an IOException could occur while reading
the stream, depending on how input is accomplished
• The program begins by creating a WebRequest object
that contains the desired URI. Notice that the Create( )
method, rather than a constructor, is used for this
purpose. Create( ) is a static member of WebRequest.
Even though WebRequest is an abstract class, it is still
possible to call a static method of that class. Create( )
returns a WebRequest object that has the proper
protocol “plugged in,” based on the protocol prefix of the
URI. In this case, the protocol is HTTP. Thus, Create( )
returns an HttpWebRequest object. Of course, its return
value must still be cast to HttpWebRequest when it is
assigned to the HttpWebRequest reference called req.
At this point, the request has been created, but not yet
sent to the specified URI.
• To send the request, the program calls
GetResponse( ) on the WebRequest object.
After the request has been sent, GetResponse( )
waits for a response. Once a response has been
received, GetResponse( ) returns a
WebResponse object that encapsulates the
response. This object is assigned to resp. Since,
in this case, the response uses the HTTP
protocol, the result is cast to HttpWebResponse.
Among other things, the response contains a
stream that can be used to read data from the
URI.
• Next, an input stream is obtained by
calling GetResponseStream( ) on resp.
This is a standard Stream object, having
all of the attributes and features of any
other input stream. A reference to the
stream is assigned to istrm. Using istrm,
the data at the specified URI can be read
in the same way that a file is read.
Next….
COM
• COM has been Microsoft’s model for
programming components in a variety of
languages, which can be built into distributed
applications.
• The .NET Framework includes support for COM
clients to use .NET components. When a COM
client needs to create a .NET object, the CLR
creates the managed object and a COM callable
wrapper (CCW) that wraps the object. The COM
client interacts with the managed object through
the CCW.
Types that need to be accessed by COM
clients must meet certain requirements :
• The managed type (class, interface, struct, or
enum) must be public.
• If the COM client needs to create the object, it
must have a public default constructor. COM
does not support parameterized constructors.
• The members of the type that are being
accessed must be public instance members.
• Private, protected, internal, and static
members are not accessible to COM clients.
Marshalling and Unmarshalling
• Marshalling governs how data is passed in
method arguments and return values between
managed and unmanaged memory during calls.
Interoperation marshalling is a run-time activity
performed by the common language runtime's
marshaling service. In few words, "Marshalling"
refers to the process of converting the data or
the objects into a byte-stream, and
"Unmarshalling" is the reverse process of
converting the byte-stream back to their original
data or object.
Usefulness of marshalling
• The .NET framework is a natural progression
from COM because the two models (assembly
or com) share many central themes, including
component reuse and language neutrality. For
backward compatibility, COM interop provides
access to existing COM components without
requiring that the original component be
modified. You can incorporate COM components
into a .NET Framework application by using
COM interop tools to import the relevant COM
types. Once imported, the COM types are ready
to use.
COM
• COM interoperability also introduces forward
compatibility by enabling your COM clients to
access managed code as easily as they access
other COM objects. Again, COM interoperability
provides the means to seamlessly export
metadata in an assembly to a type library and
registers the managed component as a
traditional COM component. Both the import and
export utilities produce results consistent with
COM specifications.
• Dynamic Method Dispatch.
• Synchronous Calling.
• Method Group Conversion.

More Related Content

What's hot

Learnadvancedjavaprogramming 131217055604-phpapp02
Learnadvancedjavaprogramming 131217055604-phpapp02Learnadvancedjavaprogramming 131217055604-phpapp02
Learnadvancedjavaprogramming 131217055604-phpapp02Hardeep Kaur
 
C++ training
C++ training C++ training
C++ training PL Sharma
 
Servlets as introduction (Advanced programming)
Servlets as introduction (Advanced programming)Servlets as introduction (Advanced programming)
Servlets as introduction (Advanced programming)Gera Paulos
 
Advanced programming ch2
Advanced programming ch2Advanced programming ch2
Advanced programming ch2Gera Paulos
 
Serialization in .NET
Serialization in .NETSerialization in .NET
Serialization in .NETAbhi Arya
 
Serialization/deserialization
Serialization/deserializationSerialization/deserialization
Serialization/deserializationYoung Alista
 
Certification preparation - Net classses and functions.pptx
Certification preparation - Net classses and functions.pptxCertification preparation - Net classses and functions.pptx
Certification preparation - Net classses and functions.pptxRohit Radhakrishnan
 
.Net Classes and Objects | UiPath Community
.Net Classes and Objects | UiPath Community.Net Classes and Objects | UiPath Community
.Net Classes and Objects | UiPath CommunityRohit Radhakrishnan
 
Certification preparation - Error Handling and Troubleshooting recap.pptx
Certification preparation - Error Handling and Troubleshooting recap.pptxCertification preparation - Error Handling and Troubleshooting recap.pptx
Certification preparation - Error Handling and Troubleshooting recap.pptxRohit Radhakrishnan
 
Data Persistence in Android with Room Library
Data Persistence in Android with Room LibraryData Persistence in Android with Room Library
Data Persistence in Android with Room LibraryReinvently
 
Java IO Package and Streams
Java IO Package and StreamsJava IO Package and Streams
Java IO Package and Streamsbabak danyal
 
Understanding C# in .NET
Understanding C# in .NETUnderstanding C# in .NET
Understanding C# in .NETmentorrbuddy
 
Reflection in C Sharp
Reflection in C SharpReflection in C Sharp
Reflection in C SharpHarman Bajwa
 

What's hot (17)

Learnadvancedjavaprogramming 131217055604-phpapp02
Learnadvancedjavaprogramming 131217055604-phpapp02Learnadvancedjavaprogramming 131217055604-phpapp02
Learnadvancedjavaprogramming 131217055604-phpapp02
 
C++ training
C++ training C++ training
C++ training
 
Servlets as introduction (Advanced programming)
Servlets as introduction (Advanced programming)Servlets as introduction (Advanced programming)
Servlets as introduction (Advanced programming)
 
Advanced programming ch2
Advanced programming ch2Advanced programming ch2
Advanced programming ch2
 
Java util
Java utilJava util
Java util
 
Serialization in .NET
Serialization in .NETSerialization in .NET
Serialization in .NET
 
Serialization/deserialization
Serialization/deserializationSerialization/deserialization
Serialization/deserialization
 
Advanced c#
Advanced c#Advanced c#
Advanced c#
 
Certification preparation - Net classses and functions.pptx
Certification preparation - Net classses and functions.pptxCertification preparation - Net classses and functions.pptx
Certification preparation - Net classses and functions.pptx
 
.Net Classes and Objects | UiPath Community
.Net Classes and Objects | UiPath Community.Net Classes and Objects | UiPath Community
.Net Classes and Objects | UiPath Community
 
Collections
CollectionsCollections
Collections
 
Certification preparation - Error Handling and Troubleshooting recap.pptx
Certification preparation - Error Handling and Troubleshooting recap.pptxCertification preparation - Error Handling and Troubleshooting recap.pptx
Certification preparation - Error Handling and Troubleshooting recap.pptx
 
Data Persistence in Android with Room Library
Data Persistence in Android with Room LibraryData Persistence in Android with Room Library
Data Persistence in Android with Room Library
 
Les23
Les23Les23
Les23
 
Java IO Package and Streams
Java IO Package and StreamsJava IO Package and Streams
Java IO Package and Streams
 
Understanding C# in .NET
Understanding C# in .NETUnderstanding C# in .NET
Understanding C# in .NET
 
Reflection in C Sharp
Reflection in C SharpReflection in C Sharp
Reflection in C Sharp
 

Viewers also liked

Powerpoint de inskape
Powerpoint de inskapePowerpoint de inskape
Powerpoint de inskape131Plutarco
 
Curso de inkscape
Curso de inkscapeCurso de inkscape
Curso de inkscapeLourdes Pla
 
Inkscape Dibuja Libremente
Inkscape Dibuja LibrementeInkscape Dibuja Libremente
Inkscape Dibuja LibrementeSyra Lacruz
 
Dibujando Con Inkscape
Dibujando Con InkscapeDibujando Con Inkscape
Dibujando Con InkscapeSyra Lacruz
 
Diseñar gráficos sencillos con inkscape
Diseñar gráficos sencillos con inkscapeDiseñar gráficos sencillos con inkscape
Diseñar gráficos sencillos con inkscapeKoldo Parra
 

Viewers also liked (8)

Powerpoint de inskape
Powerpoint de inskapePowerpoint de inskape
Powerpoint de inskape
 
Tutorial Inscape
Tutorial InscapeTutorial Inscape
Tutorial Inscape
 
Vectorizar en inkscape
Vectorizar en inkscapeVectorizar en inkscape
Vectorizar en inkscape
 
circulacion mayor y menor
circulacion mayor y menorcirculacion mayor y menor
circulacion mayor y menor
 
Curso de inkscape
Curso de inkscapeCurso de inkscape
Curso de inkscape
 
Inkscape Dibuja Libremente
Inkscape Dibuja LibrementeInkscape Dibuja Libremente
Inkscape Dibuja Libremente
 
Dibujando Con Inkscape
Dibujando Con InkscapeDibujando Con Inkscape
Dibujando Con Inkscape
 
Diseñar gráficos sencillos con inkscape
Diseñar gráficos sencillos con inkscapeDiseñar gráficos sencillos con inkscape
Diseñar gráficos sencillos con inkscape
 

Similar to Collection

Introducing object oriented programming (oop)
Introducing object oriented programming (oop)Introducing object oriented programming (oop)
Introducing object oriented programming (oop)Hemlathadhevi Annadhurai
 
DSpace 4.2 Transmission: Import/Export
DSpace 4.2 Transmission: Import/ExportDSpace 4.2 Transmission: Import/Export
DSpace 4.2 Transmission: Import/ExportDuraSpace
 
.net Based Component Technologies
.net Based Component Technologies.net Based Component Technologies
.net Based Component Technologiesprakashk453625
 
The Meteor Framework
The Meteor FrameworkThe Meteor Framework
The Meteor FrameworkDamien Magoni
 
J2EE : Java servlet and its types, environment
J2EE : Java servlet and its types, environmentJ2EE : Java servlet and its types, environment
J2EE : Java servlet and its types, environmentjoearunraja2
 
Software design with Domain-driven design
Software design with Domain-driven design Software design with Domain-driven design
Software design with Domain-driven design Allan Mangune
 
BlueHat v17 || Dangerous Contents - Securing .Net Deserialization
BlueHat v17 || Dangerous Contents - Securing .Net Deserialization BlueHat v17 || Dangerous Contents - Securing .Net Deserialization
BlueHat v17 || Dangerous Contents - Securing .Net Deserialization BlueHat Security Conference
 
Introduction to Design Patterns in Javascript
Introduction to Design Patterns in JavascriptIntroduction to Design Patterns in Javascript
Introduction to Design Patterns in JavascriptSanthosh Kumar Srinivasan
 
Collection framework
Collection frameworkCollection framework
Collection frameworkJainul Musani
 
Introduction to Spring
Introduction to SpringIntroduction to Spring
Introduction to SpringSujit Kumar
 
C# Advanced L07-Design Patterns
C# Advanced L07-Design PatternsC# Advanced L07-Design Patterns
C# Advanced L07-Design PatternsMohammad Shaker
 
1. Java Collections Framework Introduction
1. Java Collections Framework Introduction1. Java Collections Framework Introduction
1. Java Collections Framework IntroductionBharat Savani
 

Similar to Collection (20)

Collections
CollectionsCollections
Collections
 
Introducing object oriented programming (oop)
Introducing object oriented programming (oop)Introducing object oriented programming (oop)
Introducing object oriented programming (oop)
 
DSpace 4.2 Transmission: Import/Export
DSpace 4.2 Transmission: Import/ExportDSpace 4.2 Transmission: Import/Export
DSpace 4.2 Transmission: Import/Export
 
.net Based Component Technologies
.net Based Component Technologies.net Based Component Technologies
.net Based Component Technologies
 
The Meteor Framework
The Meteor FrameworkThe Meteor Framework
The Meteor Framework
 
Hibernate tutorial
Hibernate tutorialHibernate tutorial
Hibernate tutorial
 
J2EE : Java servlet and its types, environment
J2EE : Java servlet and its types, environmentJ2EE : Java servlet and its types, environment
J2EE : Java servlet and its types, environment
 
Software design with Domain-driven design
Software design with Domain-driven design Software design with Domain-driven design
Software design with Domain-driven design
 
BlueHat v17 || Dangerous Contents - Securing .Net Deserialization
BlueHat v17 || Dangerous Contents - Securing .Net Deserialization BlueHat v17 || Dangerous Contents - Securing .Net Deserialization
BlueHat v17 || Dangerous Contents - Securing .Net Deserialization
 
Introduction to Design Patterns in Javascript
Introduction to Design Patterns in JavascriptIntroduction to Design Patterns in Javascript
Introduction to Design Patterns in Javascript
 
Collection framework
Collection frameworkCollection framework
Collection framework
 
Introduction to Spring
Introduction to SpringIntroduction to Spring
Introduction to Spring
 
Design_Patterns_Dr.CM.ppt
Design_Patterns_Dr.CM.pptDesign_Patterns_Dr.CM.ppt
Design_Patterns_Dr.CM.ppt
 
06.1 .Net memory management
06.1 .Net memory management06.1 .Net memory management
06.1 .Net memory management
 
Real-Time Design Patterns
Real-Time Design PatternsReal-Time Design Patterns
Real-Time Design Patterns
 
C# Advanced L07-Design Patterns
C# Advanced L07-Design PatternsC# Advanced L07-Design Patterns
C# Advanced L07-Design Patterns
 
1. Java Collections Framework Introduction
1. Java Collections Framework Introduction1. Java Collections Framework Introduction
1. Java Collections Framework Introduction
 
Apex code (Salesforce)
Apex code (Salesforce)Apex code (Salesforce)
Apex code (Salesforce)
 
Software Design Patterns
Software Design PatternsSoftware Design Patterns
Software Design Patterns
 
Software Design Patterns
Software Design PatternsSoftware Design Patterns
Software Design Patterns
 

More from abhay singh (15)

Iso 27001
Iso 27001Iso 27001
Iso 27001
 
Web service
Web serviceWeb service
Web service
 
Unsafe
UnsafeUnsafe
Unsafe
 
Threading
ThreadingThreading
Threading
 
Preprocessor
PreprocessorPreprocessor
Preprocessor
 
Networking and socket
Networking and socketNetworking and socket
Networking and socket
 
Namespace
NamespaceNamespace
Namespace
 
Inheritance
InheritanceInheritance
Inheritance
 
Generic
GenericGeneric
Generic
 
Gdi
GdiGdi
Gdi
 
Exception
ExceptionException
Exception
 
Delegate
DelegateDelegate
Delegate
 
Constructor
ConstructorConstructor
Constructor
 
Ado
AdoAdo
Ado
 
Operator overloading
Operator overloadingOperator overloading
Operator overloading
 

Recently uploaded

Economic Importance Of Fungi In Food Additives
Economic Importance Of Fungi In Food AdditivesEconomic Importance Of Fungi In Food Additives
Economic Importance Of Fungi In Food AdditivesSHIVANANDaRV
 
PANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptxPANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptxakanksha16arora
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
Play hard learn harder: The Serious Business of Play
Play hard learn harder:  The Serious Business of PlayPlay hard learn harder:  The Serious Business of Play
Play hard learn harder: The Serious Business of PlayPooky Knightsmith
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
What is 3 Way Matching Process in Odoo 17.pptx
What is 3 Way Matching Process in Odoo 17.pptxWhat is 3 Way Matching Process in Odoo 17.pptx
What is 3 Way Matching Process in Odoo 17.pptxCeline George
 
How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17Celine George
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSAnaAcapella
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxPooja Bhuva
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxCeline George
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsSandeep D Chaudhary
 
Introduction to TechSoup’s Digital Marketing Services and Use Cases
Introduction to TechSoup’s Digital Marketing  Services and Use CasesIntroduction to TechSoup’s Digital Marketing  Services and Use Cases
Introduction to TechSoup’s Digital Marketing Services and Use CasesTechSoup
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxannathomasp01
 

Recently uploaded (20)

Economic Importance Of Fungi In Food Additives
Economic Importance Of Fungi In Food AdditivesEconomic Importance Of Fungi In Food Additives
Economic Importance Of Fungi In Food Additives
 
PANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptxPANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Play hard learn harder: The Serious Business of Play
Play hard learn harder:  The Serious Business of PlayPlay hard learn harder:  The Serious Business of Play
Play hard learn harder: The Serious Business of Play
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
What is 3 Way Matching Process in Odoo 17.pptx
What is 3 Way Matching Process in Odoo 17.pptxWhat is 3 Way Matching Process in Odoo 17.pptx
What is 3 Way Matching Process in Odoo 17.pptx
 
How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
Introduction to TechSoup’s Digital Marketing Services and Use Cases
Introduction to TechSoup’s Digital Marketing  Services and Use CasesIntroduction to TechSoup’s Digital Marketing  Services and Use Cases
Introduction to TechSoup’s Digital Marketing Services and Use Cases
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 

Collection

  • 1. Collection A collection is a group of objects
  • 2. Collection • A collection is a group of objects. The .NET Framework contains a large number of interfaces and classes that define and implement various types of collections. • Originally, there were only non-generic collection classes.
  • 3. Collection • The principal benefit of collections is that they standardize the way groups of objects are handled by your programs. • All collections are designed around a set of cleanly defined interfaces. Several built-in implementations of these interfaces, such as ArrayList, Hashtable, Stack, and Queue, are provided, which you can use as-is. • The .NET Framework supports five general types of collections: non-generic, specialized, bit-based, generic, and concurrent.
  • 4. non-generic • The non-generic collections have been part of the .NET Framework since version 1.0. • They are defined in the System.Collections namespace. • The non-generic collections are general-purpose data structures that operate on object references. • Thus, they can manage any type of object, but not in a type-safe manner. • you can mix various types of data within the same collection. • non-generic collections do not have the type-safety that is found in the generic collections. • The non-generic collections implement several fundamental data structures, including a dynamic array, stack, and queue. • They also include dictionaries, in which you can store key/value pairs.
  • 5. Specialized Collections • The specialized collections operate on a specific type of data or operate in a unique way. • For example, there are specialized collections for strings. • The specialized collections are declared in System.Collections.Specialized. • Specialized Collection:-HybridDictionary, ListDictionary, NameValueCollection, StringDictionary etc. • System.Collections also defines three abstract base classes, CollectionBase, ReadOnlyCollectionBase, and DictionaryBase, which can be inherited and used.
  • 6. Bit-based • The Collections API defines one bit-based collection called BitArray class. • BitArray supports bitwise operations on bits, such as AND and XOR. • BitArray is declared in System.Collections. • it still supports the basic collection underpinning by implementing ICollection and IEnumerable. • You can construct a BitArray from an array of Boolean values using this constructor: • public BitArray(bool[ ] values)
  • 7. Generic Collection • • • • • • The generic collections provide generic implementations of several standard data structures, such as linked lists, stacks, queues, and dictionaries. Because these collections are generic, they are type-safe. This means that only items that are type-compatible with the type of the collection can be stored in a generic collection, thus eliminating accidental type mismatches. Generic collections are declared in System.Collections.Generic namespace. There is a generic collection called LinkedList that implements a doubly linked list, but no non-generic equivalent. The generic collections work in the same way as the non-generic collections with the exception that a generic collection is type-safe. • For all cases in which a collection is storing only one type of object, then a generic collection is your best choice
  • 8. Concurrent Collection • The .NET Framework version 4.0 adds a new namespace called System.Collections.Concurrent. • It contains collections that are thread-safe and designed to be used for parallel programming. • The concurrent collections support multithreaded access to a collection. • Concurrent Collection:-BlockingCollection<T>, ConcurrentDictionary<TKey, TValue> etc.
  • 10. Handling Network Errors • To handle network exceptions that the program might generate, you must monitor calls to Create( ), GetResponse( ), and GetResponseStream( ). • It is important to understand that the exceptions that can be generated depend upon the protocol being used. • The following discussion describes several of the exceptions possible when using HTTP.
  • 11. Exceptions Generated by Create( ) • The Create( ) method defined by WebRequest it can generate four exceptions. • If the protocol specified by the URI prefix is not supported, then NotSupportedException is thrown. • If the URI format is invalid, UriFormatException is thrown. • If the user does not have the proper authorization, a System.Security.SecurityException will be thrown. • Create( ) can also throw an ArgumentNullException if it is called with a null reference, but this is not an error generated by networking. • WebRequest.Create("http://www.McGrawHill.com")
  • 12. Exceptions Generated by GetReponse( ) • A number of errors can occur when obtaining an HTTP response by calling GetResponse( ). • These are represented by the following exceptions: InvalidOperationException, ProtocolViolationException, NotSupportedException, and WebException. Of these, the one of most interest is WebException. • WebException has two properties that relate to network errors: Response and Status. • You can obtain a reference to the WebResponse object inside an exception handler through the Response property. • When an error occurs, you can use the Status property of WebException to find out what went wrong.
  • 13. Exceptions Generated by GetResponseStream( ) • For the HTTP protocol, the GetResponseStream( ) method of WebResponse can throw a ProtocolViolationException, which, in general, means that some error occurred relative to the specified protocol. • As it relates to GetResponseStream( ), it means that no valid response stream is available. • An ObjectDisposedException will be thrown if the response has already been disposed. • Of course, an IOException could occur while reading the stream, depending on how input is accomplished
  • 14. • The program begins by creating a WebRequest object that contains the desired URI. Notice that the Create( ) method, rather than a constructor, is used for this purpose. Create( ) is a static member of WebRequest. Even though WebRequest is an abstract class, it is still possible to call a static method of that class. Create( ) returns a WebRequest object that has the proper protocol “plugged in,” based on the protocol prefix of the URI. In this case, the protocol is HTTP. Thus, Create( ) returns an HttpWebRequest object. Of course, its return value must still be cast to HttpWebRequest when it is assigned to the HttpWebRequest reference called req. At this point, the request has been created, but not yet sent to the specified URI.
  • 15. • To send the request, the program calls GetResponse( ) on the WebRequest object. After the request has been sent, GetResponse( ) waits for a response. Once a response has been received, GetResponse( ) returns a WebResponse object that encapsulates the response. This object is assigned to resp. Since, in this case, the response uses the HTTP protocol, the result is cast to HttpWebResponse. Among other things, the response contains a stream that can be used to read data from the URI.
  • 16. • Next, an input stream is obtained by calling GetResponseStream( ) on resp. This is a standard Stream object, having all of the attributes and features of any other input stream. A reference to the stream is assigned to istrm. Using istrm, the data at the specified URI can be read in the same way that a file is read.
  • 18. COM • COM has been Microsoft’s model for programming components in a variety of languages, which can be built into distributed applications. • The .NET Framework includes support for COM clients to use .NET components. When a COM client needs to create a .NET object, the CLR creates the managed object and a COM callable wrapper (CCW) that wraps the object. The COM client interacts with the managed object through the CCW.
  • 19. Types that need to be accessed by COM clients must meet certain requirements : • The managed type (class, interface, struct, or enum) must be public. • If the COM client needs to create the object, it must have a public default constructor. COM does not support parameterized constructors. • The members of the type that are being accessed must be public instance members. • Private, protected, internal, and static members are not accessible to COM clients.
  • 20. Marshalling and Unmarshalling • Marshalling governs how data is passed in method arguments and return values between managed and unmanaged memory during calls. Interoperation marshalling is a run-time activity performed by the common language runtime's marshaling service. In few words, "Marshalling" refers to the process of converting the data or the objects into a byte-stream, and "Unmarshalling" is the reverse process of converting the byte-stream back to their original data or object.
  • 21. Usefulness of marshalling • The .NET framework is a natural progression from COM because the two models (assembly or com) share many central themes, including component reuse and language neutrality. For backward compatibility, COM interop provides access to existing COM components without requiring that the original component be modified. You can incorporate COM components into a .NET Framework application by using COM interop tools to import the relevant COM types. Once imported, the COM types are ready to use.
  • 22. COM • COM interoperability also introduces forward compatibility by enabling your COM clients to access managed code as easily as they access other COM objects. Again, COM interoperability provides the means to seamlessly export metadata in an assembly to a type library and registers the managed component as a traditional COM component. Both the import and export utilities produce results consistent with COM specifications.
  • 23. • Dynamic Method Dispatch. • Synchronous Calling. • Method Group Conversion.