I’ve really understood all this stuff when reading: corefx/net-platform-standard.md at master · dotnet/corefx. A must!
PCL
PCL and profiles
PCL and profiles: a comprehensive list Portable Class Library profiles, by Stephen Cleary (updated for VS 2015 Update 2).
And more Xamarin centered: Notes on Using Various PCL Profiles with Xamarin | DanRigby.com
The Bait and Switch PCL Trick
Source: The Bait and Switch PCL Trick
I was sure I’ve already blog about it but, apparently, it’s not the case. This post is about a trick to use PCL: you provides a fake implementation in PCL and real implementations, using platform dependent code, for each supported platforms. Then you combine all this implementations in one nuget package.
Doing this way, this nuget package is usable in PCL but fake implementation will never be used. This trick is based on the fact that final application is never PCL and that nuget rules will provides the more specific variant.
NString
From Thomas Levesque, a bunch of usefull string extension and a string format extended to fields and properties (use Regex to find named placeholder and Expression compilation to access it).
Supported syntax is less rich (no sub-property, no indexer) than DataBinder solution (like FormatWith 2.0 – String formatting with named variables) but it doesn’t require dependency on System.Web and can be PCL).
thomaslevesque/NString · GitHub.
Edit: We can refer to Fun With Named Formats, String Parsing, and Edge Cases and .Net ObjectFormatter – Using Tokens in a Format String for two other implementations and interesting discussion of how to escape brace and how to proceed. Basically, we have:
- to find {Xxxx}, either Regex or a hand coded parser using a small state machine,
- to evaluate Xxxx against an object instance :
- pure Reflexion to read field or property,
- Expression.Compile to read field or property,
- DataBinder.Eval with a rich syntax but slow and introducing a dependency on System.Web,
- to replace {Xxxx}, either Regex.Replace or using a generated standard String.Format with positional {2} or a manual construction.
Framework Profiles in .NET
The missing list of profile used in PCL and also a complete description of what is a TargetFrameworkProfile (with oddity detailed).
Humanizer
Lots of helper extensions to format BCL types to more readable strings (and reverse).
Just like any other library, I have concrete cases of use of some extensions and some others seems useless. I dream of possibility to choose which subsetI take from a nuget library. Splitting in multiple parts is boring to use. This must be mitigated by the fact that binary is small: 76 Ko plus localisations assemblies.
Humanizer includes an evolution of the excellent ByteSize.
Portable.Licensing
License made portable and free: Portable.Licensing. Run on a large set of platforms:
- .NET >= 4.0.3,
- Silverlight >= 4,
- Windows Phone >= 7.5,
- Windows Store Apps,
- Mono,
- Xamarin.iOS,
- Xamarin.Android,
- Xamarin.Mac,
- XBox 360.
Refit: Type-safe REST client
Refit: Type-safe REST client for:
- Xamarin.Android
- Xamarin.Mac
- Desktop .NET 4.5
- Windows Phone 8
- Silverlight 5
and also packaged as PCL (obviously :)). This library use Castle.DynamicProxy to generate proxy implementation from attributed interface and is Task/IObservable aware from the start.
Even if it’s an elegant way of avoid a lot of plumbing code, it’s double-edged. We must be sure to have all the possibilities included and some are always missing:
- Multipart requests
- Form posts
Next platform wil be Xamarin.iOS and Windows Store (WinRT).
See paulcbetts/refit.
Open source Portable Class Library for SQLite
PCL will rule the world!
New open source Portable Class Library for SQLite | MS OpenTech.
Akavache: An asynchronous, persistent key-value store
A persistent asynchrounious dictionary of blob indexed by string. Usefull to implement cache of JSON.Net, HTTP Requests, Images or User credential (a BlobCache.Secure can be used for encrypted store). SQLite3 can(/should) be used for better reliable and concurency capacities.
And, of course, available as Portable Class Library (PCL): github/Akavache.