9db35ce769 | ||
---|---|---|
build | ||
src | ||
.gitattributes | ||
.gitignore | ||
Directory.Build.props | ||
Directory.Build.targets | ||
LICENSE.txt | ||
NuGet.Config | ||
README.md | ||
build.cmd | ||
build.sh |
README.md
Portable.Xaml is a fork of mono's System.Xaml converted to PCL and .NET Standard.
This is intended to be used to read and write Xaml on desktop, mobile, and .NET Core platforms.
Supported Profiles
Portable.Xaml currently supports the following profiles:
- .NET Standard 1.3 - For .NET 4.6.1, .NET Core, UWP, Xamarin, etc.
- Profile 259 - For .NET 4.5
- Profile 136 - For .NET 4.0
Other profiles can be contributed if desired, but these should support the widest range of platforms.
Downloads
The primary way to use Portable.Xaml is by adding the nuget package to your project.
To get daily builds, add the appveyor feed to your nuget package sources. Make sure you check 'include prerelease' to show the prerelease builds.
Goals
The goal of this library is not necessarily to replicate the functionality of System.Xaml going forward, so breaking changes may occur, but only when necessary to keep migrating to Portable.Xaml straightforward.
The main difference between this and System.Xaml is that it comes with its own (minimal) TypeConverter
implementation for the PCL profiles as they do not support them. To hook into the existing System.ComponentModel.TypeConverter
on platforms that support it, a shim can be added [to be documented].
Some of the enhanced functionality of Portable.Xaml include (but not limited to):
- Supports System.Collections.Immutable collections and dictionaries.
- Automatic support for immutable types (with no default constructor) without having to use x:Arguments by using properties flagged with ConstructorArgumentAttribute automatically.
- Easier to override ParameterInfo/PropertyInfo/MethodInfo/etc XamlMember creation from XamlSchemaContext
- TypeConverter is used for items when adding to any ICollection<T> inherited list, if the type does not match.
Project Status
While this library should be usable to read & write xaml files including markup extensions, it may have some bugs.
Contributors are more than welcome! Ideally this library can become well supported to bring xaml to more applications.
Performance
What about performance you ask? Portable.Xaml's performance has been drastically improved over mono's initial implementation, and is actually much faster than .NET's System.Xaml in most cases.
Here's some results using BenchmarkDotNet:
Load
Method | Mean | StdDev | Op/s | Scaled | Gen 0 | Allocated |
---|---|---|---|---|---|---|
PortableXaml | 569.8 us | 16.294 us | 1,754.9 | 1.00 | 11.7188 | 50.56 KB |
SystemXaml | 1,325.2 us | 11.485 us | 754.6 | 2.33 | 35.1563 | 151.53 KB |
PortableXamlNoCache | 1,409.3 us | 7.649 us | 709.6 | 2.48 | 25.3906 | 106.38 KB |
SystemXamlNoCache | 1,892.2 us | 28.304 us | 528.5 | 3.32 | 44.9219 | 184.67 KB |
OmniXamlBenchmark | 8,095.5 us | 310.062 us | 123.5 | 14.22 | 406.2500 | 1689.29 KB |
Save
Method | Mean | StdDev | Op/s | Scaled | Gen 0 | Allocated |
---|---|---|---|---|---|---|
PortableXaml | 481.8 us | 2.805 us | 2,075.4 | 1.00 | 26.8555 | 110.4 KB |
SystemXaml | 809.2 us | 12.997 us | 1,235.8 | 1.68 | 28.3203 | 117.2 KB |
PortableXamlNoCache | 1,060.2 us | 34.809 us | 943.3 | 2.20 | 33.2031 | 138.91 KB |
SystemXamlNoCache | 1,151.5 us | 18.052 us | 868.5 | 2.39 | 33.2031 | 139.17 KB |
License
Portable.Xaml is licensed under MIT.