Click here to Skip to main content
16,016,527 members
Articles / Programming Languages / C#

What are Portable Class Libraries?

Rate me:
Please Sign up or sign in to vote.
4.89/5 (8 votes)
2 Sep 2013CPOL1 min read 33.9K   8   2
In this section, we will discuss the importance of portable class libraries.

The whole point of creating a class library project is reusability. Now we want this reusability not only within a .NET application, not across .NET applications, but across different types of .NET applications. Now different types of .NET applications means WPF, Windows, Silverlight, Windows phone, etc.

Image 1

Now each one of these applications run on different platforms and have different flavors of .NET Frameworks. For example, Silverlight application runs inside a browser and has a downsized version of .NET.

So in a Silverlight application, if you try to reference a simple “Class project”, you would end up with the below error. That’s where portable class libraries are useful. By creating a portable class, we can reference it in any kind of .NET project types.

Image 2

To create a portable class, we need to use the portable class template which is available in Visual Studio as shown in the below figure:

Image 3

Below is a simple youtube video which demonstrates what is a Portable Class library in C#.

Image 4

For further reading do watch the below interview preparation videos and step by step video series.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect https://www.questpond.com
India India

Comments and Discussions

 
GeneralGood info Pin
R.Hari Prasath12-Sep-13 23:40
R.Hari Prasath12-Sep-13 23:40 
Thanks for your info.
GeneralMy vote of 5 Pin
GutierrezDev2-Sep-13 10:31
professionalGutierrezDev2-Sep-13 10:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.