fundamentals of.net nyu-scps. session 7 ms certification exams in brief ms certification exams in...
TRANSCRIPT
Fundamentals Fundamentals of .NETof .NET
NYU-SCPSNYU-SCPS
Session 7Session 7 MS Certification Exams in briefMS Certification Exams in brief Custom AttributesCustom Attributes More on CollectionsMore on Collections
Additional Types with ExamplesAdditional Types with Examples Generics with ExamplesGenerics with Examples
More on StreamsMore on Streams Detailed Socket exampleDetailed Socket example More on protocol clients and listeners with examplesMore on protocol clients and listeners with examples
Building Windows ApplicationsBuilding Windows Applications Creating a Simple Windows FormCreating a Simple Windows Form Using the Visual Studio .NET DesignerUsing the Visual Studio .NET Designer Creating a Windows Forms ApplicationCreating a Windows Forms Application Populating the TreeView ControlsPopulating the TreeView Controls Handling TreeView eventsHandling TreeView events Deployment ProjectsDeployment Projects Setup ProjectSetup Project
Microsoft CertificationsMicrosoft CertificationsTechnology SpecialistTechnology Specialist
70-536.NET Framework 2.0
Application Development Foundation
70-526.NET Framework 2.0
Windows Based Applications
70-528.NET Framework 2.0
Web Based Applications
70-529.NET Framework 2.0
Web Based Applications
70-536 – App Development 70-536 – App Development FoundationFoundation
Developing applications that use system types and Developing applications that use system types and collections (15%) collections (15%)
Implementing service processes, threading, and application Implementing service processes, threading, and application domains in a .NET Framework application (11%) domains in a .NET Framework application (11%)
Embedding configuration, diagnostic, management, and Embedding configuration, diagnostic, management, and installation features into a .NET Framework application installation features into a .NET Framework application (14%) (14%)
Implementing serialization and input/output functionality in Implementing serialization and input/output functionality in a .NET Framework application (18%) a .NET Framework application (18%)
Improving the security of the .NET Framework applications Improving the security of the .NET Framework applications by using the .NET Framework 2.0 security features (20%) by using the .NET Framework 2.0 security features (20%)
Implementing interoperability, reflection, and mailing Implementing interoperability, reflection, and mailing functionality in a .NET Framework application (11%) functionality in a .NET Framework application (11%)
Implementing globalization, drawing, and text manipulation Implementing globalization, drawing, and text manipulation functionality in a .NET Framework application (11%) functionality in a .NET Framework application (11%)
70-526 – Windows Based 70-526 – Windows Based ApplicationsApplications
Creating a UI for a Windows Forms Creating a UI for a Windows Forms Application by Using Standard ControlsApplication by Using Standard Controls
Integrating Data in a Windows Forms Integrating Data in a Windows Forms ApplicationApplication
Implementing Printing and Reporting Implementing Printing and Reporting Functionality in a Windows Forms ApplicationFunctionality in a Windows Forms Application
Enhancing UsabilityEnhancing Usability Implementing Asynchronous Programming Implementing Asynchronous Programming
Techniques to Improve the User ExperienceTechniques to Improve the User Experience Developing Windows Forms Controls Developing Windows Forms Controls Configuring and Deploying Applications Configuring and Deploying Applications
70-528 – Web Based 70-528 – Web Based ApplicationsApplications
Creating and Programming a Web ApplicationCreating and Programming a Web Application Integrating Data in a Web Application by Using Integrating Data in a Web Application by Using
ADO.NET, XML, and Data-Bound ControlsADO.NET, XML, and Data-Bound Controls Creating Custom Web ControlsCreating Custom Web Controls Tracing, Configuring, and Deploying ApplicationsTracing, Configuring, and Deploying Applications Customizing and Personalizing a Web ApplicationCustomizing and Personalizing a Web Application Implementing Authentication and Authorization Implementing Authentication and Authorization Creating ASP.NET Mobile Web ApplicationsCreating ASP.NET Mobile Web Applications
70-529 – Distributed 70-529 – Distributed ApplicationsApplications
Creating and Accessing XML Web ServicesCreating and Accessing XML Web Services Configuring and Customizing a Web Service Configuring and Customizing a Web Service
ApplicationApplication Creating, Configuring, and Deploying Creating, Configuring, and Deploying
Remoting ApplicationsRemoting Applications Implementing Asynchronous Calls and Implementing Asynchronous Calls and
Remoting EventsRemoting Events Implementing Web Services Enhancements Implementing Web Services Enhancements
(WSE) 3.0(WSE) 3.0 Creating and Accessing a Serviced Creating and Accessing a Serviced
Component and Using Message QueuingComponent and Using Message Queuing
Custom AttributesCustom Attributes Programmers can define custom attributes for their Programmers can define custom attributes for their
“targets” and use them in their programs“targets” and use them in their programs These attributes may be discovered at run time by These attributes may be discovered at run time by
class methodsclass methods Attribute target is defined with the Attribute class Attribute target is defined with the Attribute class
definition – which may be one of – All, Assebly, Class, definition – which may be one of – All, Assebly, Class, Constructor, Delegate, Enum, Event, Field, Interface, Constructor, Delegate, Enum, Event, Field, Interface, Method, Module, Parameter, Property, ReturnValue, Method, Module, Parameter, Property, ReturnValue, or Structor Struct
Attributes are not inheritedAttributes are not inherited Attributes do not occupy any storage space in the Attributes do not occupy any storage space in the
heap with class data members – instead they are heap with class data members – instead they are stored in the “metadata” section of the Assembly and stored in the “metadata” section of the Assembly and are retrieved using Reflection APIare retrieved using Reflection API
197
198
199
200
201
202
Arrays
• Fast random access• Insertions will require moving memory• Deletions will require moving memory• Size is predetermined• Extending will require moving memory
Data is arranged using simple indexing algorithm
Characteristics
Scheme
Lists
• Slow random access• Insertions are quick• Deletions are quick• Size is unlimited• Can extend endlessly
197 198 199 200 201 202
head tail
Scheme Characteristics• Data is arranged using
pointers.• Head points to the first
element and Tail points to last
• Next in each node points to the next element
100
200
Hash Set
• Quite fast random access
• Insertions are quick• Deletions are quick• Size is Unlimited• Extending will not
require moving memory
197 198 199
200 201 202 203
CharacteristicsScheme• Data is arranged using
buckets.• HashCode determines
bucket• Equals determines
“match”• Cannot have duplicate
values in this “set”
hash codes
100
200
Hash Table
• Quite fast random access
• Insertions are quick• Deletions are quick• Size is Unlimited• Extending will not
require moving memory
key197 key198 key199
key200 key201 key202 key203
CharacteristicsScheme• Data is arranged using
buckets.• HashCode of key
determines bucket• Equals of key determines
“match”• Cannot have duplicate
“keys”• Value hangs off of keys
and can be duplicated
key hash codes
value197 value198 value199
value200 value201 value202 value203
More Collection ClassesMore Collection Classes Concrete Collection classesConcrete Collection classes
ArrayList, Hashtable, Queue, SortedList, StackArrayList, Hashtable, Queue, SortedList, Stack Specialized CollectionsSpecialized Collections
ListDictionary – implements Dictionary using a singly linked ListDictionary – implements Dictionary using a singly linked listlist
HybridDictionary – uses ListDictionary for small collections HybridDictionary – uses ListDictionary for small collections (of up to 10 items) and switches to a Hashtable for a large (of up to 10 items) and switches to a Hashtable for a large collectioncollection
StringDictionary – implements Dictionary where both key StringDictionary – implements Dictionary where both key and value are strings instead of Objectsand value are strings instead of Objects
NameValueCollection – represents a collection of “case NameValueCollection – represents a collection of “case insensitive” String keys and String values that may be insensitive” String keys and String values that may be accessed by key or by indexaccessed by key or by index
Concrete GenericsConcrete Generics Collection<T>, Comparer<T>, Dictionary<K,V>, List<T>, Collection<T>, Comparer<T>, Dictionary<K,V>, List<T>,
Queue<T>, SortedDictionary<K,V>, Stack<T>, Queue<T>, SortedDictionary<K,V>, Stack<T>, LinkedList<T>, ReadOnlyCollection<T>LinkedList<T>, ReadOnlyCollection<T>
Network ExamplesNetwork Examples
Socket ServerSocket Server Socket ClientSocket Client HttpListenerHttpListener MailClientMailClient
System.Windows.FormsSystem.Windows.Forms Core infrastructure: Types that represent Core infrastructure: Types that represent
the core operations of a .NET Forms the core operations of a .NET Forms program (program (Form, ApplicationForm, Application, etc.), etc.)
Controls: Types used to create rich UIs Controls: Types used to create rich UIs ((Button, ProgressBar, DataGridViewButton, ProgressBar, DataGridView etc.)etc.)
Components: Types that do not directly Components: Types that do not directly derive from “Control” but provide visual derive from “Control” but provide visual features (features (ToolTip, TimerToolTip, Timer, etc.), etc.)
Common dialog boxes: Number of canned Common dialog boxes: Number of canned dialog boxes for common operations dialog boxes for common operations ((OpenFileDialog, PrintDialogOpenFileDialog, PrintDialog, etc.), etc.)
Classes/TypesClasses/Types Application, FormApplication, Form Button, CheckBox, ComboBox, Button, CheckBox, ComboBox,
DateTimePicker, ListBox, LinkLabel, DateTimePicker, ListBox, LinkLabel, MaskedTextBox, MonthCalendar, PictureBox, MaskedTextBox, MonthCalendar, PictureBox, TreeViewTreeView
FlowLayoutPanel, TableLayoutPanelFlowLayoutPanel, TableLayoutPanel ColorDialog, OpenFileDialog, SaveFileDialog, ColorDialog, OpenFileDialog, SaveFileDialog,
FontDialog, PrintPreviewDialog, FontDialog, PrintPreviewDialog, FolderBrowserDialogFolderBrowserDialog
Menu, MainMenu, MenuItem, ContextMenu, Menu, MainMenu, MenuItem, ContextMenu, MenuStrip, ContextMenuStripMenuStrip, ContextMenuStrip
StatusBar, Splitter, ToolBar, ScrollBar, StatusBar, Splitter, ToolBar, ScrollBar, StatusStrip, ToolStripStatusStrip, ToolStrip
Building Windows AppsBuilding Windows Apps
Derive a new class from Derive a new class from System.Windows.Forms.FormSystem.Windows.Forms.Form
Call Application.Run with an Call Application.Run with an instance of this Forminstance of this Form
namespace FormExample { public class MainWindow : Form { } public class Program { static void Main() { Application.Run(new MainWindow()); } }}
Application classApplication class
Defines static members that allow Defines static members that allow you to control various behaviors of a you to control various behaviors of a Windows Forms application.Windows Forms application.
Defines a number of propertiesDefines a number of properties Defines various events and their Defines various events and their
handlers such as ApplicationExit, handlers such as ApplicationExit, Idle etc.Idle etc.
Form classForm class Defines static members that allow you to control Defines static members that allow you to control
various behaviors of a Windows Forms various behaviors of a Windows Forms application.application.
Defines a number of propertiesDefines a number of properties Defines various events and their handlers such as Defines various events and their handlers such as
ApplicationExit, Idle etc.ApplicationExit, Idle etc. Can be used to create standard, tool, borderless, Can be used to create standard, tool, borderless,
and floating windows.and floating windows. The multiple-document interface (MDI) form can The multiple-document interface (MDI) form can
contain other forms called MDI child formscontain other forms called MDI child forms Contains properties to determine the appearance, Contains properties to determine the appearance,
size, color and other window management size, color and other window management features of the window or dialog box.features of the window or dialog box.
Control ClassControl Class
Base class of controls such as Base class of controls such as Button, CheckBox etcButton, CheckBox etc
Implements basic functionality Implements basic functionality required to display information to required to display information to the user.the user.
Handles user input through Handles user input through keyboard and and mouse.keyboard and and mouse.
Events in Form classEvents in Form class
Several events are fired in the process Several events are fired in the process of loading and creating a formof loading and creating a form
Load event is fired after the Form is Load event is fired after the Form is createdcreated
Activated and Deactivated events are Activated and Deactivated events are fired when the form goes in (and out fired when the form goes in (and out of) focusof) focus
Closing event is fired when the user Closing event is fired when the user tries to close the formtries to close the form
MenusMenus MenuStrip is the main control for building MenuStrip is the main control for building
menus which may be fixed or floatingmenus which may be fixed or floating ToolStripMenuItem represents a menu ToolStripMenuItem represents a menu
item contained in MenuStripitem contained in MenuStrip ToolStripComboBox is combo box ToolStripComboBox is combo box
embedded in the menuembedded in the menu ToolStripSeparator is a simple line ToolStripSeparator is a simple line
separatorseparator ToolStripTextBox is a text box embedded ToolStripTextBox is a text box embedded
in a menu itemin a menu item
Build GridExampleApplication