Sunday, September 1, 2013

What are portable class libraries? ( .NET interview questions with answers)

This interview question is taken from the famous .NET interview question with answer book published by Bpb publications.

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 application means WPF, Windows, Silver light, Windows phone etc.


Now each one of these applications run on different platforms and have different flavors of .NET frameworks. For example silver light application runs inside a browser and has a down sized version of .NET.

So in a silver light application if you try to reference a simple “Class project” you would end with a 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.


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.



We are thankful to questpond.com to provide financial support for this site. Questpond.com has interview question videos on C# , .NET, MVC, ASP.NET , SQL Server and design patterns.

Below is a simple youtube video which demonstrates What are Portable Class library in c#.

No comments: