C#
What We Will LearnWhat We Will Learn
Configuration and Support Compiler Options Globalization Writing CLS Compliant Code XML Documentation
Delegates Async Processing Callbacks Subscribing To and Publishing Events
Developing Data Consumers and Services Data Transformation Distributed Application Programming Multithreading Using Structs and Arrays
Grammar Escape Characters Operators and Their Precedence Preprocessing Directives Program Flow Statements and Expressions
C#
What We Will LearnWhat We Will Learn
Methods Operator Overloading Parameters Pinvoke Special Methods User-Defined Conversions
Object-Oriented Programming Aggregation Encapsulation and Abstraction Inheritance and Polymorphism
Properties, Indexers, and Fields Constants and Fields Indexers Properties Variables
Value and Reference Types Attributes Conversions Object Creation and Lifetime Structs and Enums
C#
Compiler OptionsCompiler Options
Can call C# from command line csc.exe VCVARS32.BAT sets up environment No linking in C# csc File.cs produces File.exe csc /target:library File.cs produces
File.dll csc /out:My.exe File.cs produces My.exe csc /define:DEBUG /optimize
/out:File2.exe *.cs defines DEBUG and sets optimizations on
Collaboration
C#
GlobalizationGlobalization
System.Globalization.CultureInfo System.Globalization.Calendar System.Globalization.DateTimeFormatInfo System.Globalization.DaylightTime System.Globalization.GregorianCalendar System.Globalization.RegionInfo System.Globalization.SortKey
C#
CLS ComplianceCLS Compliance
Common Language Specification Affects..
Public class definitions Public members/protected members
accessed externally Params/return types of Public methods
of Public classes ClsCompliantAttribute indicates
compliance [AttributeUsage(AttributeTargets.All)]
[Serializable] public sealed class CLSCompliantAttribute : Attribute
C#
XML DocumentationXML Documentation
/doc compiler option creates XML documentation
Tags <c> text within a description that is code <code> many lines of code <example> <exception> <param> <returns> <see> <seealso> <summary>
C#
Event HandlingEvent Handling
What is an Event? Event is something interesting that
happens to a class One class can let other interested
classes (‘clients’) know when something interesting happens
Clients pass ‘delegates’ to the class they are interested in
Delegates are methods to be instantiated when the event happens
When the event occurs, the class calls the delegates of each of its clients to let them know
C#
Event HandlingEvent Handling
Delegates In the client classes, an event handler must be
declared – a method that will be called when the interesting class raises the event
The event handler must conform to the delegate signature
The event handler is then added to the interesting class’s list of event handlers
AlarmEventHandler is the delegate for the Alarm event.
A delegate is a class that can hold a reference to a method.
Unlike other classes, a delegate class has a signature
It can hold references only to methods that match its signature
Note A delegate declaration is sufficient to define a delegate class.
Event delegates in the .NET Framework have two parameters, the source that raised the event and the data for the event.
C#
Event HandlingEvent Handling
Events In the class of interest, the event
is declared and then it is raised within the On method public event AlarmEventHandler
Alarm; //event declared protected virtual void
OnAlarm(AlarmEventArgs e){...} } //method that will raise event
Alarm(this, e); //this call of the event Alarm will be within OnAlarm – in effect it calls each of the event handlers one at a time
C#
Data TransformationData Transformation
Conversions Implicit – any type can implicitly
convert to a type further down the list
• byte• short• integer• long• float/double/decimal• char
Explicit• Convert to/from any numeric type
(cast)• Can lose info/raise exceptions• Checked/unchecked
C#
What Is An Assembly?What Is An Assembly?
An assembly is very much like a COM object used to be
It contains the code that the CLR executes
It represents a Fundamental unit It represents a Security boundary It represents a Type boundary It represents a Version boundary It represents a Deployment unit It is very much like a Com component or a
Java Package
C#
What Is An Assembly?What Is An Assembly?
How is an Assembly created? Input is MSIL (Microsoft Intermediate
Language - like Java Bytecodes) MSIL is created from your source code (can
originally be VB.Net, C#, J# etc.) MSIL is converted into an ‘assembly manifest’
by Ilasm.exe Can disassemble an assembly back to MSIL
using ildasm.exe
C#
What Is The Global Assembly What Is The Global Assembly Cache?Cache?
Pool of all Assemblies that are available to be shared by many applications on that computer
Only put Assemblies in Global Assembly Cache if they need to be shared
To install an Assembly in the GAC: Use a tool called GACUtil.exe Use an installer designed to do this for you Use Explorer to drag assemblies into Cache
Must have a strong name to be in GAC
C#
Distributed ApplicationsDistributed Applications
Automatic transactions• TransactionAttribute
ServicedComponent class Base class for all COM+ components
Sign & Register Assembly
C#
Distributed ApplicationsDistributed Applications
Sign & Register Assembly Sign the assembly (use Al.exe) with a strong
name to make sure that the assembly contains a unique key pair.
Use the .NET Services Installation Tool (Regsvcs.exe) to manually register the assembly.
A strong name consists of the assembly's identity — its simple text name, version number, and culture information (if provided) — plus a public key and a digital signature. It is generated from an assembly file using the corresponding private key. (The assembly file contains the assembly manifest, which contains the names and hashes of all the files that make up the assembly.)
C#
Distributed ApplicationsDistributed Applications
Sign & Register Assembly Create strong name for assembly using sn
• sn -k sgKey.snk Set file attribute
• [assembly:AssemblyKeyFileAttribute(@"..\..\sgkey.snk")]
Remember that once you give an assembly a strong name, all assemblies that reference that assembly also have to have strong names, so that the security of the strongly named assembly is not compromised.
Note Once an assembly is created, you cannot sign it with a strong name. You can sign an assembly with a strong name only when you create it.
C#
Categorizing Requirements
Content Creation
Multiple authoring environments (intranet/internet, inside and outside organization) Fully-integrated authoring Template-based authoring Authoring using desktop applications Web-based authoring XML-based authoring User-friendly interface Usability Faster publication Consistent interface Non-technical authoring Online help Separation of content and presentation Single-sourcing (content reuse) Many contributors and Reviewers Static and interactive content to be created by non technical content editors Metadata support Index support Global taxonomy or topic map Pervasive linking Team authoring and library management Global search & replace Spell checking Cross-platform authoring Navigation aids Table support Immediate previews Support for varying content types Support both centralised & decentralised authoring Extranet access Compatibility with SOE workstations Importing external content Support for personalisation & customization Branding Multiple languages Content migration Collaborative authoring
Content managemen
t
Version control & archiving Workflow Proactive notification Syndication of content to 3rd parties Aggregation of content from 3rd parties Support varied publishing models Audit trails and activity logs Automated release & expiry of topics Automated archival of topics Managed processes for content mgt/publication Role-based management Complete export of content Replication Routing feedback Enterprise portal Records management Library management
Publishing Powerful publishing engine Automatic Expiration of Content Pre-publication of content Stylesheets Page templates Extensibility Support for multiple formats Content deployment Real-time publishing Batch publishing Hybrid publishing Error reporting Integrated search engine Browsable index and glossary Image conversion Integrating web-based applications Support for existing web platform Outsourced hosting
Presentation Usability Accessibility Cross browser support Limited client-side functionality Speed Valid HTML Effective navigation Metadata
Contract/ business
Training Documentation Warranty Maintenance Service-level agreements Software upgrades IT resources required Third-party software required Skills required Cost IT constraints Need to decrease dependence on IT resources for publishing content Reference sites Vendor staff & resources Change management Project management Partnership role Support for knowledge management Business rules
Technical Scalability Security/Privacy Reliability Integration with other data sources (databases, operating systems, file formats, web servers, ERP software etc) Reporting Personalization Localization E-mail notifications Network management (SNMP) Integration with corporate directory or authentication service Integration with existing databases Open standards Usage statistics Backup Load Balancing Disaster Recovery Contingency Redundancy Network bandwidth Accessibility Cross browser support Performance Availability Effective navigation Support for multiple formats – pdf, html, wap, xml, doc, xls, ppt etc. Operating systems supported Imaging standards supported Authoring tool support Browser based admin Auto conversion of document formats Development environment (e.g. .Net or J2EE)
C#
How to Evaluate CMSesHow to Evaluate CMSes
Select Evaluation Process(es) Formal Tender/RFP process
• Makes vendors accountable• Use a standard RFP format
http://document-management-software-system.net/rfp_template_db-gen.html#ecms
Demos • Ensure vendors demo similar features• Compare different ways in which your
needs can be met Scoring System
• Create a scoring system based upon requirements list (or RFP) to compare
C#
Cost Justification – In TheoryCost Justification – In Theory
In TheoryHigher productivity Reduced operating costs Increased employee satisfaction Increased customer satisfactionEnhanced Developer ProductivityReduced time to value Improved Scalability/ReliabilityGreater Interoperability
C#
The Reality?The Reality?
Microsoft tool for determining Cost Justification/
Cost Benefit Analysis http://www.microsoft.com/
cmserver/evaluation/roicalculator.xls
Guide to CMS evaluation http://www.em3.com/object/googlerightCM
system.html
Many CMSes are too complex for requirements
Many CMSes are too expensive to buy or implement
C#
The Solution?The Solution?
Careful requirements gathering Careful evaluation Ensure you are fully informed
http://www.cmswatch.com http://document-management-software-sy
stem.net/rfp_template_db-gen.html#ecms
Employ consultants who are fully informed (Apogee Interactive!)
Top Related