2

I know that Windows App Store applications have limited support for the System.Net namespace.

I know that for TCP and UDP protocols, the Windows.Networking namespace contains equivalents such as StreamSocket, DataReader, DataWriter, etc.

There are a few other important objects in System.Net that i use, which i cant seem to find the equivalent for in WinRT. Specifically these ones:

MailAddress
ContentType
ContentDisposition
Thread

Anyone know the equivalent for these?

c0D3l0g1c
  • 3,020
  • 5
  • 33
  • 71

1 Answers1

1

As far as I know, there are no equivalent objects for WinRT.

Do you really need those object's though?

MailAddress doesn't really add any value other than allowing you to set a Display Name along with the email address. The header for a Email with a Display Name for "From" looks like:

From: Joe Dirt <joe.dirt@somegmail.com>

You could implement your own MailAddress easily enough if you wanted to, but are you sending emails directly from the device?

ContentType, again these's only a handful of content types you really want to send/receive on a Windows Store App.

json/xml/html, and possibly some media for video/audio. But depending on what you're building, it's unnecessary considering the header value for JSON is application/json or application/json; charset=utf-8 if you want include encoding.

Phill
  • 18,398
  • 7
  • 62
  • 102
  • Hi Phil. Thanks for your comments. I've got some .net libraries that i am attempting to port for use in Windows App Store development. Needed an understanding of how critical these objects are. From the info you have given me, seems quite trivial to implement my own version of this. The 2 killers for me are TcpClient and Thread. I have a workaround for TcpClient with some effort. Any idea what to do with the Thread object? – c0D3l0g1c Jan 04 '13 at 06:30
  • Not sure about either of those sorry. I'm trying to port Amazon SDK over but am stuck with lack of cryptography support that was in .NET. WinRT is completely different API. :( – Phill Jan 04 '13 at 06:32
  • I've had a similar issue with Cryptography. They've really locked things down hard! – c0D3l0g1c Jan 04 '13 at 06:43
  • Create my own objects as recommended by Phil. – c0D3l0g1c Jan 06 '13 at 09:24
  • Isn't System.Net.Mail.MailAddress [a good way to validate email addresses](http://stackoverflow.com/a/1374644/575530)? It's [a pain](http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx/) without it. – dumbledad Apr 10 '15 at 08:40
  • @dumbledad when I answered this question in 2013, There was no equivalent. If its available now then sure its a good way. But it wasn't at the time I wrote the answer. :) – Phill Apr 10 '15 at 13:42
  • No it still isn't :-( I was commenting on your "MailAddress doesn't really add any value" to point out that it's useful for checking if an email is in a correct format. – dumbledad Apr 10 '15 at 14:14