Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is System.Tuple in portable class libraries?

I don't know if maybe I have something installed incorrectly, but having made a C# Portable Class Library targeting .NET for Windows Store apps, .NET Framework 4.5, Silverlight 4 and higher, Windows Phone 7 and higher, I'm getting errors that System.Tuple is missing.

How could this be?

like image 847
Rei Miyasaka Avatar asked Nov 29 '12 11:11

Rei Miyasaka


People also ask

What is portable class library?

The Portable Class Library project enables you to write and build managed assemblies that work on more than one . NET Framework platform. You can create classes that contain code you wish to share across many projects, such as shared business logic, and then reference those classes from different types of projects.

What is the difference between .NET Standard and PCL portable class libraries?

NET Standard and PCLs: . NET Standard is a set of curated APIs, picked by Microsoft, PCLS are not. The APIs that a PCL contains is dependent on the platforms that you choose to target when you create a PCL.

What is PCL project?

PCL projects target specific profiles that support a known set of BCL classes/features. However, the down side to PCL is that they often require extra architectural effort to separate profile specific code into their own libraries.


1 Answers

Tuple[<...>] doesn't exist in Windows Phone 7, so you can't use it if you are targeting that platform.

I've just validated, and if you create a PCL targeting:

  • .NET for Windows Store apps
  • .NET Framework 4.5
  • Silverlight 4 and higher

but not "Windows Phone 7 and higher", then it works fine and you can use Tuple[<...>].

For completeness, it also doesn't exist if you include Xbox 360.

like image 155
Marc Gravell Avatar answered Sep 30 '22 17:09

Marc Gravell