SlideShare une entreprise Scribd logo
1  sur  11
Portable Class Library
Nat
2014/03/14
Problem
• The same code can’t reuse in these Platforms
• .NET Framework
• .NET for Windows Store apps
• Windows Phone
• Silverlight
• Xbox
• If want to cross platform, only do copy and paste
Solution
• The Portable Class Library project supports a subset of assemblies
from the .NET Framework, Silverlight, .NET for Windows Store apps,
Windows Phone, and Xbox 360
Prerequisites
• VS2012+
• VS2010 has install Portable Library Tools 2
• http://visualstudiogallery.msdn.microsoft.com/b0e0b5e9-e138-410b-ad10-
00cb3caf4981/
Target Platforms
Supported Features
Supported Types and Members
• They must be shared across the target platforms you selected.
• 它們必須在您選取的目標平台之間共用。
• The must behave similarly across those platforms.
• 它們必須在這些平台上具有類似的行為。
• They must not be candidates for deprecation.
• 它們不能是要被取代的候選項。
• They must make sense in a portable environment, especially when
supporting members are not portable.
• 它們在可攜式環境中必須是合理的,尤其是支援成員無法移植時。
Find supported in the Portable Class
Library
Supporting the Model-View-View Model
(MVVM) Pattern
• When you target the .NET Framework 4.5, .NET for Windows Store
apps, Silverlight, and Windows Phone
• System.Collections.ObjectModel.ObservableCollection<T>
• System.Collections.ObjectModel.ReadOnlyObservableCollection<T>
• System.Collections.Specialized.INotifyCollectionChanged
• System.Collections.Specialized.NotifyCollectionChangedAction
• System.Collections.Specialized.NotifyCollectionChangedEventArgs
• System.Collections.Specialized.NotifyCollectionChangedEventHandler
• System.ComponentModel.DataErrorsChangedEventArgs
• System.ComponentModel.INotifyDataErrorInfo
• System.ComponentModel.INotifyPropertyChanged
• System.Windows.Input.ICommand
Creating a Portable Class Library Project
Reference
• Cross-Platform Development with the .NET Framework
• http://msdn.microsoft.com/en-us/library/gg597391(v=vs.110).aspx

Contenu connexe

Plus de LearningTech

Plus de LearningTech (20)

vim
vimvim
vim
 
PostCss
PostCssPostCss
PostCss
 
ReactJs
ReactJsReactJs
ReactJs
 
Docker
DockerDocker
Docker
 
Semantic ui
Semantic uiSemantic ui
Semantic ui
 
node.js errors
node.js errorsnode.js errors
node.js errors
 
Process control nodejs
Process control nodejsProcess control nodejs
Process control nodejs
 
Expression tree
Expression treeExpression tree
Expression tree
 
SQL 效能調校
SQL 效能調校SQL 效能調校
SQL 效能調校
 
flexbox report
flexbox reportflexbox report
flexbox report
 
Vic weekly learning_20160504
Vic weekly learning_20160504Vic weekly learning_20160504
Vic weekly learning_20160504
 
Reflection &amp; activator
Reflection &amp; activatorReflection &amp; activator
Reflection &amp; activator
 
Peggy markdown
Peggy markdownPeggy markdown
Peggy markdown
 
Node child process
Node child processNode child process
Node child process
 
20160415ken.lee
20160415ken.lee20160415ken.lee
20160415ken.lee
 
Peggy elasticsearch應用
Peggy elasticsearch應用Peggy elasticsearch應用
Peggy elasticsearch應用
 
Expression tree
Expression treeExpression tree
Expression tree
 
Vic weekly learning_20160325
Vic weekly learning_20160325Vic weekly learning_20160325
Vic weekly learning_20160325
 
D3js learning tips
D3js learning tipsD3js learning tips
D3js learning tips
 
git command
git commandgit command
git command
 

Portable class library_nat_20140314

  • 2. Problem • The same code can’t reuse in these Platforms • .NET Framework • .NET for Windows Store apps • Windows Phone • Silverlight • Xbox • If want to cross platform, only do copy and paste
  • 3. Solution • The Portable Class Library project supports a subset of assemblies from the .NET Framework, Silverlight, .NET for Windows Store apps, Windows Phone, and Xbox 360
  • 4. Prerequisites • VS2012+ • VS2010 has install Portable Library Tools 2 • http://visualstudiogallery.msdn.microsoft.com/b0e0b5e9-e138-410b-ad10- 00cb3caf4981/
  • 7. Supported Types and Members • They must be shared across the target platforms you selected. • 它們必須在您選取的目標平台之間共用。 • The must behave similarly across those platforms. • 它們必須在這些平台上具有類似的行為。 • They must not be candidates for deprecation. • 它們不能是要被取代的候選項。 • They must make sense in a portable environment, especially when supporting members are not portable. • 它們在可攜式環境中必須是合理的,尤其是支援成員無法移植時。
  • 8. Find supported in the Portable Class Library
  • 9. Supporting the Model-View-View Model (MVVM) Pattern • When you target the .NET Framework 4.5, .NET for Windows Store apps, Silverlight, and Windows Phone • System.Collections.ObjectModel.ObservableCollection<T> • System.Collections.ObjectModel.ReadOnlyObservableCollection<T> • System.Collections.Specialized.INotifyCollectionChanged • System.Collections.Specialized.NotifyCollectionChangedAction • System.Collections.Specialized.NotifyCollectionChangedEventArgs • System.Collections.Specialized.NotifyCollectionChangedEventHandler • System.ComponentModel.DataErrorsChangedEventArgs • System.ComponentModel.INotifyDataErrorInfo • System.ComponentModel.INotifyPropertyChanged • System.Windows.Input.ICommand
  • 10. Creating a Portable Class Library Project
  • 11. Reference • Cross-Platform Development with the .NET Framework • http://msdn.microsoft.com/en-us/library/gg597391(v=vs.110).aspx