.NET Development Foundation: Difference between revisions
[unreviewed revision] | [unreviewed revision] |
Line 72: | Line 72: | ||
Wikipedia's definition is: "The Microsoft .NET Framework is a software component included with the Microsoft Windows operating system. It provides a large body of pre-coded solutions to common software development requirements, and manages the execution of programs written specifically for the framework. The .NET Framework is intended to be used by most new applications created for the Windows platform" |
Wikipedia's definition is: "The Microsoft .NET Framework is a software component included with the Microsoft Windows operating system. It provides a large body of pre-coded solutions to common software development requirements, and manages the execution of programs written specifically for the framework. The .NET Framework is intended to be used by most new applications created for the Windows platform" |
||
The problem with Microsoft's definition is that it refers to a "managed code programming model" which is still Microsoft terminology. The best defintion for it: "Managed code is code that has its execution managed by the .NET Framework Common Language Runtime" (see Brad Adams blog on [http://blogs.msdn.com/brada/archive/2004/01/09/48925.aspx MSDN]). |
|||
Wikipedia's definition points to the two more important aspects from a developper point of view: |
|||
*The presence of a '''huge''' set of class libraries that allows for all of the common programming tasks. Atop the sheer size of the those class libraries, they are also evolving at a rapid paste. |
|||
*The fact that the execution environment is specific to the framework. The term "virtual machine" is often used to qualify such an environment. |
|||
==System types and collections== |
==System types and collections== |
Revision as of 04:06, 5 December 2007
Preface
Welcome to the 'Microsoft .NET Framework 2.0 Application Development Foundation' module.
Please give us you feedback on the module so we can improve it (see discussion page).
The preface contains information relevant to the context of the document, authors, wikibooks, etc. You can skip to the Introduction if you are primarely interested in the module content.
Contributions
This module is far from over! Please do not hesitate to improve it as you see fit.
Just a couple of pointers thow if you are a new contributor to wikibooks:
- Wikibooks are about textbooks not "standard" wikis. The project team is looking for continuous narratives that can be read from top to bottom. For somebody used to the MSDN type of documentation this can be a significant adjusment.
- Links only pages does not fit the above picture and are actively discouraged. If you create a page, be sure to have content to put on it :-)
- The administrators use templates to ask questions or notify of incomplete tasks. Those templates produce rather flashy notices that can be surprising at first. Don't worry about the look and ask for clarifications. The admins are very helpful and nice and will help you with whatever you may need.
- Code samples are very welcome and should be put in "hidden" sections to preserve the flow of the text. see example section. A sample should be kept as short as possible but the space limitations of printed material obviously do not apply here. We thus encourage you to have complete, yet clear and simple, programs so they can be directly tested and used.
- Use the discussion page for questions or comments.
Exam information and certifications
Current information on the exam can be found at MSDN Exam Information
This module is the study guide for the first exam (70-536) for obtaining many Microsoft certifications:
- Microsoft Certified Technology Specialist: .NET Framework 2.0 Web Applications
- Microsoft Certified Technology Specialist: .NET Framework 2.0 Windows_Applications
- Microsoft Certified Technology Specialist: .NET Framework 2.0 Distributed Applications
- Microsoft Certified Professionnal Developer: Web development
- Microsoft Certified Professionnal Developer: Windows development
- Microsoft Certified Professionnal Developer: Enterprise application development
Authors
William "Scott" Baker (User:Scott98390)
- If you contribute to this book, if you wish, please add your name here. The contributors for a specific article can be traced by its history.
Please note that it is not wikibook's policy to have link only pages or pages with very few text. The preferred way is to have continuous textbooks that can be read from start to finish. The first contributions to this module where in the form of separate pages for each third or forth level exam objectives. This gave way to numerous pages that are in the process of beeing merged into more consistent global pages. This process have the adverse side effect of losing references for the contributions to those detailed pages. We apologize if your texts or links have been moved in this way.
Introduction
This module is structured around the objectives set by Microsoft for the 70-536 Exam. Chapters 2 to 8 represents each of the 7 major objective categories of the exam.
For each chapter a first section covers the major concepts (topics). A second section then details each of the second, third and fourth level exam objectives for that objective category.
As of december 4th 2007, 24 subjects where detailed on separate pages (the blue links).
Most of the detailed subjects point to the corresponding section on MSDN2 (Microsoft's developpers documentation).
Whenever possible the "topics" sections link to wikipedia articles to give you a feel of how the concepts are defined and treated outside of Microsoft's world.
The .NET Framework
In the certification paths where exam 70-536 "Microsoft .NET Framework 2.0 Application Development Foundation" is present, it represents the first step of the cetification process. It is thus natural to start this first study guide with a short discussion of the framework as a whole.
The definition on MSDN .NET main page is: "The .NET Framework is Microsoft's managed code programming model for building applications on Windows clients, servers, and mobile or embedded devices. Developers use .NET to build applications of many types: Web applications, server applications, smart client applications, console applications, database applications, and more".
Wikipedia's definition is: "The Microsoft .NET Framework is a software component included with the Microsoft Windows operating system. It provides a large body of pre-coded solutions to common software development requirements, and manages the execution of programs written specifically for the framework. The .NET Framework is intended to be used by most new applications created for the Windows platform"
The problem with Microsoft's definition is that it refers to a "managed code programming model" which is still Microsoft terminology. The best defintion for it: "Managed code is code that has its execution managed by the .NET Framework Common Language Runtime" (see Brad Adams blog on MSDN).
Wikipedia's definition points to the two more important aspects from a developper point of view:
- The presence of a huge set of class libraries that allows for all of the common programming tasks. Atop the sheer size of the those class libraries, they are also evolving at a rapid paste.
- The fact that the execution environment is specific to the framework. The term "virtual machine" is often used to qualify such an environment.
System types and collections
Exam objective: Developing applications that use system types and collections.
Topics
System types
Collections
For a tutorial see GotDotNet
For some "prescriptive guidance" see AspNetResources
Generics
Specialized
System Interfaces
Events and Delegates
Classes, Interfaces, and tools
System types
Exam objective: Manage data in a .NET Framework application by using the .NET Framework 2.0 system types.
(Refer System namespace)
Exception classes
- Some links to MSDN:
TypeForwardedToAttribute Class - MSDN
- For a discussion of TypeForwardToAttribute in the CLR see MSDN
- Other possible links: Marcus' Blog, NotGartner
Collections
Exam objective: Manage a group of associated data in a .NET Framework application by using collections.
(Refer System.Collections namespace - MSDN)
Collection interfaces
- IComparer interface, IEqualityComparer interface, and IKeyComparer interface
- IComparer interface - MSDN
- IEqualityComparer interface - MSDN
- IKeyComparer interface - IKeyComparer does not exist in .Net 2.0
- IDictionary interface and IDictionaryEnumerator interface
- IDictionary interface - MSDN
- IDictionaryEnumerator interface - MSDN
- IHashCodeProvider interface - MSDN - Interface is now obsolete (as of .NET 2.0)
Hashtable class - MSDN
- Used to represent a collection of key/value pairs.
CollectionBase class and ReadOnlyCollectionBase class
- CollectionBase class - MSDN
- ReadOnlyCollectionBase class -MSDN
DictionaryBase class and DictionaryEntry class
- DictionaryBase class - MSDN
- DictionaryEntry structure - MSDN
Comparer class - MSDN
Queue class - MSDN
SortedList class - MSDN
BitArray class - MSDN
Stack class - MSDN
Generic collections
Exam objective: Improve type safety and application performance in a .NET Framework application by using generic collections.
(Refer System.Collections.Generic namespace MSDN )
Collection.Generic interfaces
- see also ONDotnet
- Generic IComparable interface - MSND
- (Refer System Namespace)
- Generic ICollection interface and Generic IList interface
- Generic ICollection interface - MSDN
- Generic IList interface - MSDN
- Generic IComparer interface and Generic IEqualityComparer interface
- Generic IComparer interface - MSDN
- Generic IEqualityComparer interface - MSDN
- Generic IDictionary interface - MSDN
- Generic IEnumerable interface and Generic IEnumerator interface
- Generic IEnumerable interface - MSDN
- Generic IEnumerator interface - MSDN
- IHashCodeProvider interface - MSDN - Interface is now obsolete (as of .NET 2.0)
Generic Dictionary
- Generic Dictionary class and Generic Dictionary.Enumerator structure
- Generic Dictionary class - MSDN
- Generic Dictionary.Enumerator structure - MSDN
- Generic Dictionary.KeyCollection class and Dictionary.KeyCollection.Enumerator structure
- Generic Dictionary.KeyCollection class - MSDN
- Dictionary.KeyCollection.Enumerator structure - MSDN
- Generic Dictionary.ValueCollection class and Dictionary.ValueCollection.Enumerator structure
- Generic Dictionary.ValueCollection class - MSDN]
- Dictionary.ValueCollection.Enumerator structure - MSDN]
Generic Comparer class and Generic EqualityComparer class
- Generic Comparer class - MSDN
- Generic EqualityComparer class - MSDN
Generic KeyValuePair structure - MSDN
Generic List class, Generic List.Enumerator structure, and Generic SortedList class
- Generic List class - MSDN
- A generic list class instance is simply declared using the List<T> syntax where T is the specific type.
- Generic List.Enumerator structure - MSDN
- Generic SortedList class - MSDN
Generic Queue class and Generic Queue.Enumerator structure
- Generic Queue class - MSDN
- Generic Queue.Enumerator structure - MSDN
Generic SortedDictionary class - MSDN
- For differences between SortedList and SortedDictionary are explained see MSDN
Generic LinkedList
- A Generic Linked List represents a doubly linked list and is a general-purpose linked list. It supports enumerators and implements the ICollection interface, consistent with other classes in the .NET Framework.
- Generic LinkedList class - MSDN
- Generic LinkedList.Enumerator structure - MSDN
- Generic LinkedListNode class - MSDN
Generic Stack class and Generic Stack.Enumerator structure
- Generic Stack class - MSDN
- Generic Stack.Enumerator structure - MSDN
Specialized collections
Exam objective: Manage data in a .NET Framework application by using specialized collections.
(Refer System.Collections.Specialized namespace)
Specialized String classes
- StringCollection class - MSDN
- StringDictionary class - MSDN
- StringEnumerator class - MSDN
Specialized Dictionary classes
- HybridDictionary class - MSDN
- IOrderedDictionary interface and OrderedDictionary class
- IOrderedDictionary Interface - MSDN
- OrderedDictionary class - MSDN
- ListDictionary class - MSDN
Named collections
- NameObjectCollectionBase class - MSDN
- NameObjectCollectionBase.KeysCollection class - MSDN
- NameValueCollection class - MSDN
CollectionsUtil class
CollectionsUtil class - MSDN
BitVector32 structure and BitVector32.Section structure
- BitVector32 structure - MSDN
- BitVector32.Section structure - MSDN
Standard interfaces
Exam objective: Implement .NET Framework interfaces to cause components to comply with standard contracts.
(Refer System namespace)
IComparable interface - MSDN
- The IComparable interface defines a comparison method that a value type or class implements to create a type-specific comparison method
IDisposable interface - MSDN
- The IDispose interface can be used to explicitly release unmanaged resources in custom classes. The consumer of an object can call this method when the object is no longer needed.
- The .Net garbage collector releases memory allocated to managed objects when they are no longer used, however, it is not possible to predict when garbage collection will occur and it has no knowledge of unmanaged resources such as window handles, or open files and streams.
IConvertible interface - MSDN
ICloneable interface - MSDN
INullableValue interface - MSDN
IEquatable interface - MSDN
IFormattable interface - MSDN
Events and delegates
Exam objectives: Control interactions between .NET Framework application components by using events and delegates.
(Refer System namespace)
EventArgs class - MSDN
EventHandler delegates - MSDN
Services, threading, and application domains
Exam objective: Implementing service processes, threading, and application domains in a .NET Framework application
Topics
Services
Mutithreading
Application Domain
Classes, Interfaces, and tools
Implement, install, and control a service
Exam objective: Implement, install, and control a service
(Refer System.ServiceProcess namespace)
Inherit from ServiceBase class
ServiceController class and ServiceControllerPermission class
- ServiceController class - MSDN
- ServiceControllerPermission class - MSDN
ServiceInstaller and ServiceProcessInstaller class
- ServiceInstaller - MSDN
- ServiceProcessInstaller class - MSDN
ServiceChangeDescription structure and ServiceChangeReason enumeration
- SessionChangeDescription structure - MSDN
- SessionChangeReason enumeration - MSDN
Develop multithreaded applications
Exam objective: Develop multithreaded .NET Framework applications
(Refer System.Threading namespace)
Thread class - MSDN
ThreadPool class - MSDN
ThreadStart delegate, ParameterizedThreadStart delegate, and SynchronizationContext class
Timeout class, Timer class, TimerCallback delegate, WaitCallback delegate, WaitHandle class, and WaitOrTimerCallback delegate
- Timeout class
- Timer class
- TimerCallback delegate
- WaitCallback delegate
- WaitHandle class
- WaitOrTimerCallback delegate
ThreadExceptionEventArgs class and ThreadExceptionEventHanlder class
- ThreadExceptionEventArgs class
- ThreadExceptionEventHanlder class
ThreadState enumeration and ThreadPriority enumeration
- ThreadState enumeration
- ThreadPriority enumeration
ReaderWriterLock class
AutoResetEvent class and ManualResetEvent class
- AutoResetEvent class
- ManualResetEvent class
IAsyncResult interface and ICancelableAsyncResult interface
- (Refer System namespace)
- IAsyncResult interface
- ICancelableAsyncResult interface
EventWaitHandle class, RegisterWaitHandle class, SendOrPostCallback delegate, and IOCompletionCallback delegate
- EventWaitHandle class
- RegisterWaitHandle class
- SendOrPostCallback delegate
- IOCompletionCallback delegate
Interlocked class, NativeOverlapped structure, and Overlapped class
- Interlocked class
- NativeOverlapped structure
- Overlapped class
ExecutionContext class, HostExecutionContext class, HostExecutionContext manager, and ContextCallback delegate
- ExecutionContext class
- HostExecutionContext class
- HostExecutionContext manager
- ContextCallback delegate
LockCookie structure, Monitor class, Mutex class, and Semaphore class
- LockCookie structure
- Monitor class
- Mutex class
- Semaphore class
Using applications domains
Exam objective: Create a unit of isolation for common language runtime in a .NET Framework application by using application domains
(Refer System namespace)
Create an application domain - MSDN
- An application domain is a division of a process into multiple parts. Applications running in different application domains are as isolated as they would be in different processes.
- Application domains are easier to maintain and are faster because it is easier to communicate between application domains than between processes. An application domain can hold multiple assemblies.
Unload an application domain - MSDN
Configure an application domain - MSDN
Retrieve setup information from an application domain - MSDN
Load assemblies into an application domain - MSDN
Configuration, diagnostic, management, and installation
Exam objective: Embedding configuration, diagnostic, management, and installation features into a .NET Framework application
Topics
Configuration management
.NET framework installer
Event log
MSDN's definition is "Windows event logs allow your applications and components to record information about important events. You can use these records to audit access to your system, troubleshoot problems, and re-create usage patterns"
For a general discussion see MSDN
For specifics on the EventLog class and some cautions about its use see MSDN
System processes
Performance monitoring
Debugging and tracing
Management information and events
Classes, Interfaces, and tools
Embed configuration management
Exam objective: Embed configuration management functionality into a .NET Framework application.
(Refer System.Configuration namespace)
Configuration class and ConfigurationManager class
- Configuration class - MSDN
- ConfigurationManager class - MSDN
ConfigurationSettings class, ConfigurationElement class, ConfigurationElementCollection class, and ConfigurationElementProperty class
- ConfigurationSettings class - MSDN
- ConfigurationElement class - MSDN
- ConfigurationElementCollection class - MSDN
- ConfigurationElementProperty class - MSDN
Implement IConfigurationSectionHandler interface - MSDN
ConfigurationSection class, ConfigurationSectionCollection class, ConfigurationSectionGroup class, and ConfigurationSectionGroupCollection class
- ConfigurationSection class
- ConfigurationSectionCollection class
- ConfigurationSectionGroup class
- ConfigurationSectionGroupCollection
Implement ISettingsProviderService interface
Implement IApplicationSettingsProvider interface
ConfigurationValidationBase class
Implement IConfigurationSystem interface
Create custom installer and configure application
Exam objective: Create a custom Microsoft Windows Installer for .NET Framework components by using the System.Configuration.Install namespace, and configure the .NET Framework applications by using configuration files, environment variables, and the .NET Framework Configuration tool (Mscorcfg.msc).
Installer class
Configure which runtime version a .NET Framework application should use
Configure where the runtime should search for an assembly
Configure the location of an assembly and which version of the assembly to use
Direct the runtime to use the DEVPATH environment variable when searching for assemblies
AssemblyInstaller class
ComponentInstaller class
Configure a .NET Framework application by using the .NET Framework Configuration tool (Mscorcfg.msc)
ManagedInstaller class
InstallContext class
InstallerCollection class
Implement IManagedInstaller interface
InstallEventHandler delegate
Configure concurrent garbage collection
Register remote objects by using configuration files
Manage an event log
Exam objective: Manage an event log by using the System.Diagnostics namespace
Write to an event log
Read from an event log
Create a new event log
You create an EventLog by creating the first event source that writes to that log.
The two simplest way to do this are:
- Use the EventLog.CreateEventSource method
- Create an EventLog instance, specify a source and then write to the log. The actual creation takes place on execution of the first write.
C# EventLog creation Example
using System; using System.Collections.Generic; using System.Text; using System.Diagnostics; namespace EventLogLab1 { class Program { static void Main(string[] args) { try { EventLog log1 = new EventLog("EvtLab2Log"); log1.Source = "EvtLab2Source"; // Actual creation happens next log1.WriteEntry("Example message", EventLogEntryType.Information, 123, 1); } catch (Exception e) { Console.WriteLine(e.Message); } Console.WriteLine("Press ENTER to finish"); Console.ReadLine(); } } }
The recommended way, which does not seem to be covered on the Training Kit (so probably not on the exam) is to use the EventLogInstaller class during the installation of the application. For reference purposes see MSDN
Manage processes and monitor performance
Exam objective: Manage system processes and monitor the performance of a .NET Framework application by using the diagnostics functionality of the .NET Framework 2.0.
(Refer System.Diagnostics namespace)
Get a list of all running processes.
- Process class - MSDN
- For example code for GetCurrentProcess(), GetProcessesByName(), GetProcesses(), and GetProcessById() see MSDN
Retrieve information about the current process - MSDN
Get a list of all modules loaded by a process
- The Process.Modules property returns a stronlgy-typed collection of ProcessModule objects that represent the Process' currently loaded modules.
- For the Process.Modules property see MSDN
- For the ProcessModule class see MSDN
PerformanceCounter class, PerformanceCounterCategory, and CounterCreationData class
- PerformanceCounter class - MSDN
- PerformanceCounterCategory - MSDN
- CounterCreationData class - MSDN
Start a process both by using and by not using command-line arguments.
StackTrace class
StackFrame class
Debug and Trace
Exam objective: Debug and trace a .NET Framework application by using the System.Diagnostics namespace.
Debug class and Debugger class
Trace class
CorrelationManager class
TraceListener class
TraceSource class
TraceSwitch class
XmlWriterTraceListener class
DelimitedListTraceListener class
EventlogTraceListener class
Debugger attributes
- DebuggerBrowsableAttribute class
- DebuggerDisplayAttribute class
- DebuggerHiddenAttribute class
- DebuggerNonUserCodeAttribute class
- DebuggerStepperBoundaryAttribute class
- DebuggerStepThroughAttribute class
- DebuggerTypeProxyAttribute class
- DebuggerVisualizerAttribute class
Embed management information
Exam objective: Embed management information and events into a .NET Framework application.
(Refer System.Management namespace)
- Enumerate all disk drivers, network adapters, and processes on a computer.
Retrieve information about all network connections
- Retrieve information about all services that are paused.
ManagementQuery class
EventQuery class - MSDN
- ObjectQuery class
Subscribe to management events by using the ManagementEventWatcher class
Serialization and Input/Output
Exam objective: Implementing serialization and input/output functionality in a .NET Framework application
Topics
Serialization
Wikipedia's definition for serialiation is : "in the context of data storage and transmission, serialization is the process of saving an object onto a storage medium (such as a file, or a memory buffer) or to transmit it across a network connection link in binary form".
The problem that is addressed here is that an object is created by a running process and is thus bound to the lifetime of that process instance. If for whatever reason, and there can be many, you want to "transport" the object in the context of another process instance you've got a problem, that you solve by "saving" the state of you object in the original process and "restoring" it in the destination process. This "saving" part is called serialization and the "restoring" part is caled deserialization.
Serializable attribute
An object is serializable if it's class name is be prefixed with the [Serializable] attribute.
Object Serialization
One can use the BinaryFormatter class to serialize an object. To serialize, use the BinaryFormatter's Serialize() method which takes a stream and a serializable object as parameters. To deserialize, use the BinaryFormatter's Deserialize() method which takes a stream as a parameter and returns a object that can be cast back to the original object type. Remember to close streams after you use them by calling the stream's Close() method.
XML Serialization
One can use the XmlSerializer class to serialize an object. To serialize, use the XmlSerializer's Sserialize() method which takes a stream and a serializable object as parameters. To deserialize, use the XmlSerializer's Deserialize() method which takes a stream as a parameter and returns a object that can be cast back to the original object type. Remember to close streams after you use them by calling the stream's Close() method.
For an overview of XML and SOAP serialization see MSDN
Custom Serialization
The ISerializable interface allows an object to control its own serialization and deserialization.
Readers
Writers
Formatters
A formatter is used to serialize objects into streams.
Streams
File IO
Managing Byte Streams
Compression
Isolated storage
For a general discussion on IsolatedStorage tasks see MSDN
Classes, Interfaces, and tools
Serialize and deserialize
Exam objective: Serialize or deserialize an object or an object graph by using runtime serialization techniques.
(Refer System.Runtime.Serialization namespace)
Serialization interfaces
IDeserializationCallback interface - MSDN
IFormatter interface and IFormatterConverter interface
- IFormatter interface - MSDN
- IFormatterConverter interface - MSDN
ISerializable interface - MSDN
Serilization attributes
- For some serialization attributes exemple see MSDN
OnDeserializedAttribute class and OnDeserializingAttribute class
- OnDeserializedAttribute class - MSDN
- OnDeserializingAttribute class - MSDN
OnSerializedAttribute class and OnSerializingAttribute class
- OnSerializedAttribute class - MSDN
- OnSerializingAttribute class - MSDN
OptionalFieldAttribute class - MSDN
SerializationEntry structure and SerializationInfo class
SerializationEntry structure - MSDN
SerializationInfo class - MSDN
ObjectManager class
ObjectManager class - MSDN
Formatter class, FormatterConverter class, and FormatterServices class
Formatter class - MSDN
FormatterConverter class - MSDN
FormatterServices class - MSDN
StreamingContext structure
StreamingContext structure - MSDN
XML Serialization
Exam objective: Control the serialization of an object into XML format by using the System.Xml.Serialization namespace.
XmlSerializer class - MSDN
- Exam objective: Serialize and deserialize objects into XML format by using the XmlSerializer class
Control serialization by using serialization attributes - MSDN
- For a list of attributes for controlling serialization see MSDN
Implement XML Serialization interfaces to provide custom formatting for XML serialization
Delegates and event handlers are provided by the System.Xml.Serialization namespace
Custom serialization
Exam objective: Implement custom serialization formatting by using the Serialization Formatter classes.
SoapFormatter clas - MSDN
- (Refer System.Runtime.Serialization.Formatters.Soap namespace)
BinaryFormatter class - MSDN
- (Refer System.Runtime.Serialization.Formatters.Binary namespace
File system classes
Exam objective: Access files and folders by using the File System classes.
(Refer System.IO namespace)
File class and FileInfo class
- For common IO tasks see MSDN
- File class - MSDN
- FileInfo class - MSDN
Directory class and DirectoryInfo class
- Directory class - MSDN
- DirectoryInfo class - MSDN
DriveInfo class and DriveType enumeration
- DriveInfo class - MSDN
- DriveType enumeration - MSDN
FileSystemInfo class and FileSystemWatcher class
ErrorEventArgs class and ErrorEventHandler delegate
- ErrorEventArgs class
- ErrorEventHandler delegate
RenamedEventArgs class and RenamedEventHandler delegate
- RenamedEventArgs class
- RenamedEventHandler delegate
Byte streams
Exam objective: Manage byte streams by using Stream classes.
(Refer System.IO namespace)
FileStream class - MSDN
Stream class - MSDN
- System.IO.Stream is the abstract base class that all other streams inherit from. It is not possible in instantiate a Stream class. Instead use one of the other classes that derive from Stream.
- In terms of the 70-536 exam objectives, the most important classes that inherit from Stream are:
- System.IO.FileStream
- System.IO.MemoryStream
- System.IO.Compression.DeflateStream
- System.IO.Compression.GZipStream
- System.Security.Cryptography.CryptoStream
- System.IO.BufferedStream
- For a complete list of classes that inherit from Stream see MSDN.
- For a discussion on File and Stream IO see MSDN.
MemoryStream class - MSDN
BufferedStream class - MSDN
Reader and Writer classes
Exam objective: Manage the .NET Framework application data by using Reader and Writer classes.
(Refer System.IO namespace)
StringReader class and StringWriter class
TextReader class and TextWriter class
StreamReader class and StreamWriter class
BinaryReader class and BinaryWriter class
- BinaryReader class - MSDN
- BinaryWriter class - MSDN
Compression and isolated storage
Exam objective: Compress or decompress stream information in a .NET Framework application and improve the security of application data by using isolated storage.
(Refer System.IO.Compression namespace)
(Refer System.IO.IsolatedStorage namespace)
IsolatedStorageFile class - MSDN
IsolatedStorageFileStream class - MSDN
DeflateStream class - MSDN
GZipStream class - MSDN
Security
Exam objective: Improving the security of the .NET Framework applications by using the .NET Framework 2.0 security features
Topics
Code access security
Code access security, CAS, allows the control of various permissions granted to specific managed applications. MSDN
Permissions allow access system resources. A permission set is a collection of permissions. A code group relates exactly one permission set to exactly one evidence type. Evidence is used to identify an assembly. Evidence types can include the application directory, cryptographic hash of the assembly, publisher's digital signature, site from which the assembly was downloaded, cryptographic strong name of the assembly, URL from which the assembly was downloaded, and the security zone in which the assembly is running. Security zones include the computer zone, local intranet zone, Internet zone, trusted site, and untrusted sites. See the Internet options security tab in Internet Explorer to view various security zones. An assembly can be associated with multiple code groups. Permission sets can be associated with multiple code groups.
A security policy is a logical grouping of code groups and permission sets. An untrusted managed assembly must pass through four security policies: The Enterprise security policy, machine security policy, user security policy, and application domain security policy. Any one of these security policies can deny an untrustrd managed assembly permissions.
Classes, interfaces, and tools
Implement code access security
Exam objective: Implement code access security to improve the security of a .NET Framework application.
(Refer System.Security namespace)
SecurityManager class
CodeAccessPermission class
Modify the Code Access security policy at the machine, user, and enterprise policy level by using the Code Access Security Policy tool (Caspol.exe)
PermissionSet class, NamedPermissionSet class, and PermissionSetCollection class
- PermissionSet class
- NamedPermissionSet class
- PermissionSetCollection class
Standard Security interfaces
- IEvidenceFactory interface
- IPermission interface
Implement access control
Exam objective: Implement access control by using the System.Security.AccessControl classes.
DirectorySecurity class, FileSecurity class, FileSystemSecurity class, and RegistrySecurity class
- DirectorySecurity class
- FileSecurity class
- FileSystemSecurity class
- RegistrySecurity class
AccessRule class - MSDN
AuthorizationRule class and AuthorizationRuleCollection class
- AuthorizationRule class
- AuthorizationRuleCollection class
CommonAce class, CommonAcl class, CompoundAce class, GeneralAce class, and GeneralAcl class
- CommonAce class
- CommonAcl class
- CompoundAce class
- GeneralAce class
- GeneralAcl class
AuditRule class
MutexSecurity class, ObjectSecurity class, and SemaphoreSecurity class
- MutexSecurity class
- ObjectSecurity class
- SemaphoreSecurity class
Implement custom authentication scheme
Exam objective: Implement a custom authentication scheme by using the System.Security.Authentication classes.
(Refer System.Security.Authentication namespace)
Authentication algorithms and SSL protocols
Encrypt, decrypt and hash data
Exam objective: Encrypt, decrypt, and hash data by using the System.Security.Cryptography classes.
(Refer System.Security.Cryptography namespace)
DES class and DESCryptoServiceProvider class
- DES class
- DESCryptoServiceProvider class
HashAlgorithm class
DSA class and DSACryptoServiceProvider class
- DSA class
- DSACryptoServiceProvider class
SHA1 class and SHA1CryptoServiceProvider class
- SHA1 class
- SHA1CryptoServiceProvider class
TripleDES and TripleDESCryptoServiceProvider class
- TripleDES
- TripleDESCryptoServiceProvider class
MD5 class and MD5CryptoServiceProvider class
- MD5 class
- MD5CryptoServiceProvider class
RSA class and RSACryptoServiceProvider class
- RSA class
- RSACryptoServiceProvider class
RandomNumberGenerator class
CryptoStream class
CryptoConfig class
RC2 class and RC2CryptoServiceProvider class
- RC2 class
- RC2CryptoServiceProvider class
AssymetricAlgorithm class
ProtectedData class and ProtectedMemory class
- ProtectedData class
- ProtectedMemory class
RijndaelManaged class and RijndaelManagedTransform class
- RijndaelManaged class
- RijndaelManagedTransform class
CspParameters class
CryptoAPITransform class
Hash-based Message Authentication Code (HMAC)
- HMACMD5 class
- HMACRIPEMD160 class
- HMACSHA1 class
- HMACSHA256 class
- HMACRIPEMD160 class
- HMACSHA1 class
- HMACSHA256 class
- HMACSHA384 class
- HMACSHA512 class
Control permissions
Exam objective: Control permissions for resources by using the System.Security.Permission classes.
(Refer System.Security.Permission namespace)
SecurityPermission class
PrincipalPermission class
FileIOPermission class - MSDN
- You can also set the FileIoPermisson attribute at assembly level or class level. Be then aware about the SecurityAction enumerations:
- SecurityAction.RequestRefuse: specifies the operations that should not be granted.
- SecurityAction.RequestMinumum: request for a minimum set of permissions. If not given, the app will not execute.
StrongNameIdentityPermission class
UIPermission class
UrlIdentityPermission class
PublisherIdentityPermission class
GacIdentityPermission class
FileDialogPermission class
DataProtectionPermission class
EnvironmentPermission class
IUnrestrictedPermission interface
RegistryPermission class
IsolatedStorageFilePermission class
KeyContainerPermission class
ReflectionPermission class
StorePermission class
SiteIdentityPermission class
ZoneIdentityPermission class
Control code privileges
Exam objective: Control code privileges by using System.Security.Policy classes.
(Refer System.Security.Policy namespace)
ApplicationSecurityInfo class and ApplicationSecurityManager class
- ApplicationSecurityInfo class
- ApplicationSecurityManager class
ApplicationTrust class and ApplicationTrustCollection class
- ApplicationTrust class
- ApplicationTrustCollection class
Evidence class and PermissionRequestEvidence class
- Evidence class
- PermissionRequestEvidence class
CodeGroup class, FileCodeGroup class, FirstMatchCodeGroup class, NetCodeGroup class, and UnionCodeGroup class
- CodeGroup class
- FileCodeGroup class
- FirstMatchCodeGroup class
- NetCodeGroup class
- UnionCodeGroup class
Condition classes
- AllMembershipCondition class
- ApplicationDirectory class and ApplicationDirectoryMembershipCondition class
- ApplicationDirectory class
- ApplicationDirectoryMembershipCondition class
- GacMembership class and GacMembershipCondition class
- GacMembership class
- GacMembershipCondition class
- Hash class and HashMembershipCondition class
- Hash class
- HashMembershipCondition class
- Publisher class and PublisherMembershipCondition class
- Publisher class
- PublisherMembershipCondition class
- Site class and SiteMembershipCondition class
- Site class
- SiteMembershipCondition class
- StrongName class and StrongNameMembershipCondition class
- StrongName class
- StrongNameMembershipCondition class
- Url class and UrlMembershipConditon class
- Url class
- UrlMembershipConditon class
- Zone class and ZoneMembershipCondition class
- Zone class
- ZoneMembershipCondition class
PolicyLevel class and PolicyStatement class
- PolicyLevel class
- PolicyStatement class
IApplicationTrustManager interface, IMembershipCondition interface, and IIdentityPermissionFactory interface
- IApplicationTrustManager interface
- IMembershipCondition interface
- IIdentityPermissionFactory interface
Access and modifiy identity information
Exam objective: Access and modify identity information by using the System.Security.Principal classes.
(Refer System.Security.Principal namespace)
GenericIdentity class and GenericPrincipal class
- GenericIdentity class
- GenericPrincipal class
WindowsIdentity class and WindowsPrincipal class
- WindowsIdentity class
- WindowsPrincipal class
NTAccount class and SecurityIdentifier class
- NTAccount class
- SecurityIdentifier class
IIdentity interface and IPrincipal interface
- IIdentity interface
- IPrincipal interface
WindowsImpersonationContext class
IdentityReference class and IdentityReferenceCollection class
- IdentityReference class
- IdentityReferenceCollection class
Interoperability, Reflection, and Mailing
Exam objective: Implementing interoperability, reflection, and mailing functionality in a .NET Framework application
Topics
Interoperability
Reflection
The wikipedia definition for reflexion in computer science is: "The process by which a computer program of the appropriate type can be modified in the process of being executed".
The concept is implemented extensively in .NET because a lot of information is maintained at the intermediate language (MSIL) level.
Among other things you can:
- get information about running assembly or assembly constituants (modules, classes, methods, etc.), this is particularly usefull for dynamically loaded assemblies that are not known at compile time.
- put custom attributes in your code and retreive those attributes at run time
- dynamically invoke methods
- "emit" and execute MSIL code at run time
Mailing
Classes, Interfaces, and tools
COM interoperability
Exam objective: Expose COM components to the .NET Framework and .NET Framework components to COM
(Refer System.Runtime.InteropServices namespace)
Import a type library as an assembly.
- Add references to type libraries.
- Type Library Importer (Tlbimp.exe)
- Generate interop assemblies from type libraries.
- - Imported Library Conversion
- - Imported Module Conversion
- - Imported Member Conversion
- - Imported Parameter Conversion
Create COM types in managed code.
Deploy an interop application.
Qualify the .NET Framework types for interoperation.
Apply Interop attributes, such as the ComVisibleAttribute class.
Deploy an application for COM access.
Call DLL functions
Exam objective: Call unmanaged DLL functions in a .NET Framework application, and control the marshalling of data in a .NET Framework application.
(Refer System.Runtime.InteropServices namespace)
Create a class to hold DLL functions.
Create prototypes in managed code.
Call a DLL function
- Look for "P/Invoke" on the internet.
- A good reference is: http://www.pinvoke.net/
- Some short hints:
- For the DllAttribute "CharSet", Logically, CharSet.Auto is the most secure way as this will autodetect the Charset used. The CharSet can be ANSI(Win95/Win98/ME) or Unicode (Win2000/WinXP)
- GetEntryPoint: There could be one tricky question as the EntryPoint states the method that should be called. In case the name of the method used differs from the method to be called, this flag is necessary.
Create a new Exception class and map it to an HRESULT.
Marshal data with Platform Invoke - MSDN
MarshalAsAttribute class and Marshal class
Implement Reflexion
Exam objective: Implement reflection functionality in a .NET Framework application (refer System.Reflection namespace), and create metadata, Microsoft intermediate language (MSIL), and a PE file by using the System.Reflection.Emit namespace.
- AssemblyAlgorithmIdAttribute class
- AssemblyCompanyAttribute class
- AssemblyConfigurationAttribute class
- AssemblyCopyrightAttribute class
- AssemblyCultureAttribute class
- AssemblyDefaultAliasAttribute class
- AssemblyDelaySignAttribute class
- AssemblyDescriptionAttribute class
- AssemblyFileVersionAttribute class
- AssemblyFlagsAttribute class
- AssemblyInformationalVersionAttribute class
- AssemblyKeyFileAttribute class
- AssemblyTitleAttribute class
- AssemblyTrademarkAttribute class
- AssemblyVersionAttribute class
MethodBase class and MethodBody class
Send Electronic mail
Exam objective: Send electronic mail to a Simple Mail Transfer Protocol (SMTP) server for delivery from a .NET Framework application.
(Refer System.Net.Mail namespace)
MailAddress class and MailAddressCollection class
SmtpClient class, SmtpPermission class, and SmtpPermissionAttribute class
Attachment class, AttachmentBase class, and AttachmentCollection class
SmtpException class, SmtpFailedReceipientException class, and SmtpFailedReceipientsException class
SendCompleteEventHandler delegate
LinkedResource class and LinkedResourceCollection class
AlternateView class and AlternateViewCollection class
Globalization, Drawing, and Text manipulation
Exam objective: Implementing globalization, drawing, and text manipulation functionality in a .NET Framework application
Topics
Globalization
Drawing
Text manipulation
Text manipulation, in the context of the exam objectives, covers 3 main subjects: string building, regular expressions and text encoding. We look at each in the follwing paragraphs.
String and StringBuilder classes
Text manipulation starts with the representation of a string which is done via the String class. No specific exam objective mentions the String class but we added a section for it because you must understand some of its specific caracteristics.
Next comes the StringBuilder class that serves for efficent construction.
Regular expressions
The Regex, Match and Group classes together implement the regular expressions support in the .NET framework.
Regular expressions are a world by themselves and have been around for quite some time.
There is a wikibook on regular expressions which, among other things, point to this Tutorial.
Regular expressions support in .NET basically allows for:
- testing the match of a string to a regex pattern (Regex.IsMatch method)
- extracting the substrings that "match" part of a pattern (Regex.Match method with Match and Group classes).
Text encoding
Classes, Interfaces, and tools
Format data based on culture information.
(Refer System.Globalization namespace)
Access culture and region information
Exam objective: Access culture and region information in a .NET Framework application
CultureInfo class
CultureTypes enumeration
RegionInfo class
Format date and time values based on the culture.
DateTimeFormatInfo class
Format number values based on the culture.
NumberFormatInfo class - MSDN
NumberStyles enumeration
Perform culture-sensitive string comparison.
CompareInfo class
CompareOptions enumeration
Custom culture
Exam objective: Build a custom culture class based on existing culture and region classes
CultureAndRegionInfoBuilder class
CultureAndRegionModifier enumeration
System.Drawing namespace
Exam objective: Enhance the user interface of a .NET Framework application by using the System.Drawing namespace.
Brushes, Pens, Colors and Fonts
Exam objective: Enhance the user interface of a .NET Framework application by using brushes, pens, colors, and fonts
Brush class - MSDN
Brushes class - MSDN
SystemBrushes class - MSDN
TextureBrush class - MSDN
Pen class - MSDN
Pens class - MSDN
SystemPens class - MSDN
SolidBrush class - MSDN
Color structure - MSDN
ColorConverter class - MSDN
ColorTranslator class - MSDN
SystemColors class - MSDN
StringFormat class - MSDN
Font class - MSDN
FontConverter class - MSDN
FontFamily class - MSDN
SystemFonts class - MSDN
Graphics, Images, Bitmaps and Icons
Exam objective: Enhance the user interface of a .NET Framework application by using graphics, images, bitmaps, and icons
Graphics class - MSDN
BufferedGraphics class - MSDN
BufferedGraphicsManager class - MSDN
Image class - MSDN
ImageConverter class - MSDN
ImageAnimator class - MSDN
Bitmap class - MSDN
Icon class - MSDN
IconConverter class - MSDN
SystemIcons class - MSDN
Shapes and Sizes
Exam objective: Enhance the user interface of a .NET Framework application by using shapes and sizes
Point Structure - MSDN
PointConverter class - MSDN
Rectangle Structure - MSDN
RectangleConverter class - MSDN
Size Structure - MSDN
SizeConverter class - MSDN
Region class - MSDN
Text handling and regular expressions
Exam objective: Enhance the text handling capabilities of a .NET Framework application, and search, modify, and control text in a .NET Framework application by using regular expressions
(Refer System.Text namespace)
(Refer System.RegularExpressions namespace)
String class
The String class is not a specific exam objective but was added to have a place to discuss some of its caracteristics.
String class - MSDN
StringBuilder class
Regex class
Regex class - MSDN
Match class and MatchCollection class
Match class - MSDN
MatchCollection class - MSDN
Group class and GroupCollection class
Group class - MSDN
GroupCollection class - MSDN
Encode text by using Encoding classes
Encoding class - MSDN
EncodingInfo class - MSDN
ASCIIEncoding class - MSDN
UnicodeEncoding class - MSDN
UTF8Encoding class - MSDN
Encoding Fallback classes - MSDN
Decode text by using Decoding classes.
Decoder class - MSDN
Decoder Fallback classes - MSDN
Capture class and CaptureCollection class
Capture class - MSDN
CaptureCollection class - MSDN