
Swift and C# Quick Reference – Language Equivalents and Code Examples [pdf] - masters3d
http://download.microsoft.com/download/4/6/9/469501F4-5F6B-4E51-897C-9A216CFB30A3/SwiftCSharpPoster.pdf
======
ianhedoesit
I can't find an accompanying article or anything for this. I'm curious as to
why Microsoft would put something like this out? Why make the comparison in
the first place? Why compare it to Swift?

Also, the code at [http://aka.ms/scspostercode](http://aka.ms/scspostercode)
is nice.

~~~
thejew
They are trying to get you to use Xamarin. See here:
[https://twitter.com/masters3d/status/571785335702626304](https://twitter.com/masters3d/status/571785335702626304)

~~~
edgyswingset
Speaking as someone who loves C# and has tried Xamarin ... it ain't ready for
iOS yet. A significant amount of iOS development is done in the Designer and
Storyboard, and Xamarin falls well short. The addition of needing to use a mac
as a buildhost just makes it inconvenient.

I definitely see it improving in the future (I personally view Xamarin
development as a better option for Android than standard Java), but it's not
something I would recommend for an actual workplace to use.

~~~
miguelrochefort
What issues do you have with Xamarin's iOS Designer? I actually prefer it to
Xcode's.

~~~
liampronan
What are your reasons for preferring Xamarin? I've been meaning to try it out
but have not gotten around to it

------
alkonaut
If you find the "classes" section makes no sense, it's because the heading
column is one line out of sync with the other columns.

------
Alphasite_
What I find strange is that some of these examples dont even do the same
thing, which is a little odd when you're trying to do a fair comparison. And
some weird non optimal syntax on both sides.

Im also a not a fan of the pure white, but thats quite a minor complaint.

------
rdavisau
I went to an 'Azure Mobile DevCamp' event for iOS a couple of days ago. It was
sponsored by Microsoft but run by someone otherwise unaffiliated who ran a
mobile development shop coding in each platform's native language.

The session was interactive/follow along, the instructor led in swift and I
decided to try following along using C#/Xamarin iOS (disclosure: I use
Xamarin.iOS daily and am a big fan of C#). On iOS I had worked for a couple of
years in obj-c before moving to Xamarin, but hadn't touched swift. Having read
comparison articles similar to this, my otherwise uninformed opinion was that
swift looked to provided a far more reasonable experience, similar to C# - to
the point that I wondered whether it was worth paying the fee for Xamarin to
avoid the archaic objective c language. However, there were a few things from
the demo that changed my mind (some are apple ecosystem, some are swift):

\- no first class support for package management, and adding references to to
libraries by hand can still be error prone and frustrating. We spent 10
minutes getting the room set up with their cocoapods - lucky me I had NuGet
and in a few clicks had the packages installed. \- no `await`-style capability
- it seems small but nested callbacks is not something I want to have to deal
with anymore, and it makes certain patterns unwieldy. \- no LINQ query
provider style support - making a call to the azure mobile service with a
filter and sort clauses required newing up awkward predicate and sort objects
and attaching them to a query before running (which then, again, required a
callback!). In C# you could use the same syntax you would use if the
collection were local - `await table.Where(i=>
i.Name.Contains("Bob")).OrderBy(i=> i.LastName).ToListAsync()` - and the
clauses would be transparently translated into parameters for the service
call. \- Lots of "crashes" in the IDE while writing swift code, where the
compiler would bomb out and syntax highlighting etc. would be disabled while
it sorted itself out again.

Swift still seems to be a huge improvement over obj-c, and some of these will
be improved as time goes by, but fundamental features like await make a big
difference, especially working on mobile where you are often waiting on
network calls, user activity etc. And that's all before you even touch the
topic of code sharing.

~~~
Osmium
> We spent 10 minutes getting the room set up with their cocoapods

Cocoapods with Swift support is still in beta. You'll probably have a better
experience once it's been officially released.

> Lots of "crashes" in the IDE while writing swift code, where the compiler
> would bomb out and syntax highlighting etc. would be disabled while it
> sorted itself out again.

Likewise for this; Xcode is a much better IDE for Objective-C than it is for
Swift at the moment, but it is improving (a new beta of Swift 1.2 + Xcode has
just been released that fixes a lot of problems).

~~~
pionar
XCode is a horrible IDE for any language.

~~~
hutattedonmyarm
I think it has improved a lot in the last years,to the point where it'S
actually pretty good

------
mythz
As it's relevant, ServiceStack also provides integration with XCode that lets
you generate a typed API for easily consuming C# JSON Web Services in Swift
iOS/OSX Apps:

[https://github.com/ServiceStack/ServiceStack/wiki/Swift-
Add-...](https://github.com/ServiceStack/ServiceStack/wiki/Swift-Add-
ServiceStack-Reference)

------
masters3d
I made a couple of tables to keep track of the changes to swift
[https://github.com/masters3d/SwiftCSharp](https://github.com/masters3d/SwiftCSharp)

------
thejew
Swift has internal now.

~~~
TazeTSchnitzel
And C# has string interpolation!

~~~
SideburnsOfDoom
C# _will soon have_ string interpolation. The release date is, I think, still
some time later in 2015. it's just the compiler's syntactic sugar around
string.Format() but yeah, it looks nice.

------
_random_
Beautiful presentation.

