portable-class-library

C# [anonymous\generic] object to byte[] without BinaryFormatter [in .NET 4.5]?

喜欢而已 提交于 2020-01-04 02:15:14
问题 BinaryFormatter works great, but doesn't exist in Portable class libraries for .NET 4.5. I've read that it IS in .NET 4.6 Portable. I have not confirmed this because when I change to 4.6 in my project settings, I get a warning message that "4.5 will be automatically targeted" unless I de-select Silverlight, WindowsPhone, Windows Universal, Xamarin, etc), so I can only target .NET 4.6 Portable if I'm NOT targeting additional platforms, thus defeating the purpose. Here is my original

.NET Portable Class Library [Serializable] Attribute

送分小仙女□ 提交于 2020-01-03 10:47:30
问题 I have a common class library containing many models for my server and my client. Since the client is running under Xamarin, the common library must be a Portable Class Library (PCL). In my server, these objects are passed around with AppDomain Remoting/Marshaling, so to my understanding an object either needs to be marked as [Serializable] or inherit from MarshalByRefObject Being in a PCL, I cannot do either of these things to any of my models. My question is: How can I make these objects

C# PCL HMACSHAX with BouncyCastle-PCL

早过忘川 提交于 2020-01-02 18:07:34
问题 I want to implement this logic in portable C# class: static JsonWebToken() { HashAlgorithms = new Dictionary<JwtHashAlgorithm, Func<byte[], byte[], byte[]>> { { JwtHashAlgorithm.HS256, (key, value) => { using (var sha = new HMACSHA256(key)) { return sha.ComputeHash(value); } } }, { JwtHashAlgorithm.HS384, (key, value) => { using (var sha = new HMACSHA384(key)) { return sha.ComputeHash(value); } } }, { JwtHashAlgorithm.HS512, (key, value) => { using (var sha = new HMACSHA512(key)) { return sha

C# PCL HMACSHAX with BouncyCastle-PCL

佐手、 提交于 2020-01-02 18:05:00
问题 I want to implement this logic in portable C# class: static JsonWebToken() { HashAlgorithms = new Dictionary<JwtHashAlgorithm, Func<byte[], byte[], byte[]>> { { JwtHashAlgorithm.HS256, (key, value) => { using (var sha = new HMACSHA256(key)) { return sha.ComputeHash(value); } } }, { JwtHashAlgorithm.HS384, (key, value) => { using (var sha = new HMACSHA384(key)) { return sha.ComputeHash(value); } } }, { JwtHashAlgorithm.HS512, (key, value) => { using (var sha = new HMACSHA512(key)) { return sha

Portable Class Library, XmlAnyElementAttribute

放肆的年华 提交于 2020-01-02 16:22:07
问题 In a Portable Class Library , I have a class that contains a member with an XmlAnyElement attribute. public partial class VariableWebServiceResponse { private List<System.Xml.XmlElement> anyField; public VariableWebServiceResponse () { this.anyField = new List<System.Xml.XmlElement>(); } [System.Xml.Serialization.XmlAnyElementAttribute(Order=0)] public List<System.Xml.XmlElement> Any { get { return this.anyField; } set { this.anyField = value; } } } This type of class works perfectly in .NET

Visual Studio 2015 + Xamarin + Native Portable PCL + WCF

南笙酒味 提交于 2020-01-02 07:27:15
问题 So our enterprise is going the Xamarin route using Visual Studio. Going through all the documentation online showed that it should be Trivial to create WCF proxy client out of a web service and place it in the PCL. After Struggling and trying to figure out why I couldn't compile the PCL using the SLSVcUtil.exe generated classes or why the "Add Service Reference" menu item was missing i gave up and downloaded the sample projects. Turns out what I was missing all along was the target profile

How to ignor self signed certificates with System.Net.Http.HttpClient in Universal Windows App

拟墨画扇 提交于 2020-01-02 04:09:26
问题 I am creating a Portable Class Library which means I must use System.Net.Http.HttpClient to call my web APIs as far as I understand. The challenge is that for my Universal Windows App, I cannot figure out how to ignore the error that is returned due to the fact the fact the API server can have a self signed certificate. Any suggestions would be greatly appreciated. UPDATE: I cannot import any certificates as this will be an application that runs on various devices in various organizations and

Why do some NuGet packages provide both a Portable Library and an Platform Specific One?

拥有回忆 提交于 2020-01-02 04:01:27
问题 It is my understanding that Portable Class Libraries can be used on many platforms, based upon the subset of the framework the designer of the library choose to support. I noticed that many libraries available via NuGet also include a platform specific implementation and wonder what is the need for this. For instance, the Microsoft.Net.Http package comes with many variations, including : Net 4.0 version WinRT (Windows Store Apps) Windows 8 Version Portable Class Library supporting Net 4.0,

Is there any way to use RNGCryptoServiceProvider class in C# Portable class Library

主宰稳场 提交于 2020-01-01 18:26:19
问题 I am working on a encryption algorithm and using cryptography for this. I want to make this portable, but didn't find any way to resolve this class. 回答1: You can also use the full managed Bouncy Castle Library. A Portable Class Library Patch is available here: http://www.bouncycastle.org/jira/browse/BMA-107 A pre-build of Bouncy Castle 1.7 with the PCL Patch is available here for example: https://github.com/dnauck/Portable.Licensing/tree/master/lib 回答2: You Didn't mention what profile you are

How can I build a targetting pack for Portable Class Libraries?

风流意气都作罢 提交于 2020-01-01 10:13:12
问题 I'm building some code with these portable class libraries at present. I'm looking to target full .Net, WinRT Metro, Windows Phone, ... and then MonoTouch and MonoDroid. My experiments today show this can work - http://slodge.blogspot.co.uk/2012/04/experiments-with-portable-class.html However, I have hit a fairly significant problem - MonoTouch and MonoDroid currently support these libraries in that you can consume PCLs as binary assemblies, but they don't allow linking between project files