Amir Saniyan
Amir Saniyan

Reputation: 13729

Should I use WinRT APIs in a .NET (for example C#) project?

I'm confused about WinRT and .NET.

These namespaces: http://msdn.microsoft.com/en-us/library/windows/apps/br211377.aspx exist in WinRT but they are not complete (for example System.IO does not exist).

For socket programming there are two namespaces:

1- System.Net.Sockets in .NET library.

2- Windows.Networking.Sockets in WinRT.

Should I use the WinRT APIs in a .NET project? If the answer is 'yes' then why should I use WinRT APIs instead of the .NET APIs?

Upvotes: 1

Views: 1235

Answers (2)

Richard Banks
Richard Banks

Reputation: 12546

If you are writing a normal .NET application (i.e. traditional windows desktop application, ASP.NET web site, WCF service, and so forth) then you will use the standard .NET profiles and WinRT won't be an available option.

If you are writing a Metro style application for Windows 8 then you are restricted to the Metro profile of .NET. This removes a lot of usual namespaces you are used to and replaces them with the WinRT APIs. This is a deliberate choice by Microsoft to improve the security, portability and responsiveness of Metro applications.

Upvotes: 5

Dean Chalk
Dean Chalk

Reputation: 20461

you need to use WinRT API's if you want to develop apps that run in the Metro environment in Windows 8 (and are therefore potentially available in the windows 8 marketplace). The .NET CLR runs in an 'API restricted' mode on top on WinRT to allow the metro app to be properly sandboxed. File IO is missing because this is not allowed in the metro sandboxed environment.

Upvotes: 2

Related Questions