Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Insider News
  4. Basic comparison of C# and Apple Swift programming language syntax

Basic comparison of C# and Apple Swift programming language syntax

Scheduled Pinned Locked Moved The Insider News
csharpswiftiosmobilecom
7 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kent Sharkey
    wrote on last edited by
    #1

    Chris Pietschmann[^]:

    There are a lot of developers that use C# every day and the purpose of this post is to help them understand what Swift offers at a language level compared to C#. And, before you start the "apples and oranges" arguments, it's worth pointing out that using Xamarin you can develop iOS and OSX apps using C#.

    "Let's flip the track, bring the old school back. This is how we do it."

    P J D 3 Replies Last reply
    0
    • K Kent Sharkey

      Chris Pietschmann[^]:

      There are a lot of developers that use C# every day and the purpose of this post is to help them understand what Swift offers at a language level compared to C#. And, before you start the "apples and oranges" arguments, it's worth pointing out that using Xamarin you can develop iOS and OSX apps using C#.

      "Let's flip the track, bring the old school back. This is how we do it."

      P Offline
      P Offline
      PIEBALDconsult
      wrote on last edited by
      #2

      Maybe he's not very familiar with C#: " Switch statements are rather similar in both languages except that in Swift case statements don't automatically pass on to the next like in C#. As a result C# requires the use of the break keywords to exit the Switch statement, unless you want to fall through to the next case. While in Swift you must use the "fallthrough" keyword to tell it to pass on through to the next case statement. More information on this can be found in the Swift documentation. " It sounds like he means "C" when he says "C#", but I do wish C and C# behaved the way he describes Swift does. Swift appears to have some features I'd like, but I doubt I'll ever be using Swift.

      You'll never get very far if all you do is follow instructions.

      R 1 Reply Last reply
      0
      • P PIEBALDconsult

        Maybe he's not very familiar with C#: " Switch statements are rather similar in both languages except that in Swift case statements don't automatically pass on to the next like in C#. As a result C# requires the use of the break keywords to exit the Switch statement, unless you want to fall through to the next case. While in Swift you must use the "fallthrough" keyword to tell it to pass on through to the next case statement. More information on this can be found in the Swift documentation. " It sounds like he means "C" when he says "C#", but I do wish C and C# behaved the way he describes Swift does. Swift appears to have some features I'd like, but I doubt I'll ever be using Swift.

        You'll never get very far if all you do is follow instructions.

        R Offline
        R Offline
        r_hyde
        wrote on last edited by
        #3

        He must have been thinking of C#'s special treatment of the empty case body, which does fall through.

        P 1 Reply Last reply
        0
        • R r_hyde

          He must have been thinking of C#'s special treatment of the empty case body, which does fall through.

          P Offline
          P Offline
          PIEBALDconsult
          wrote on last edited by
          #4

          Oh my... You seem to be correct. " The scope of each case can’t be empty. As a result, you must include at least one statement following the colon (:) of each case label. " That's horrible. :wtf:

          You'll never get very far if all you do is follow instructions.

          1 Reply Last reply
          0
          • K Kent Sharkey

            Chris Pietschmann[^]:

            There are a lot of developers that use C# every day and the purpose of this post is to help them understand what Swift offers at a language level compared to C#. And, before you start the "apples and oranges" arguments, it's worth pointing out that using Xamarin you can develop iOS and OSX apps using C#.

            "Let's flip the track, bring the old school back. This is how we do it."

            J Offline
            J Offline
            JMK NI
            wrote on last edited by
            #5

            He's not really comparing it with C# is he? He's comparing Swift with the parts of C# which are common to all C based languages, no mention of LINQ, Generics, ORM etc etc and their equivalents in Swift

            K 1 Reply Last reply
            0
            • K Kent Sharkey

              Chris Pietschmann[^]:

              There are a lot of developers that use C# every day and the purpose of this post is to help them understand what Swift offers at a language level compared to C#. And, before you start the "apples and oranges" arguments, it's worth pointing out that using Xamarin you can develop iOS and OSX apps using C#.

              "Let's flip the track, bring the old school back. This is how we do it."

              D Offline
              D Offline
              Dan Neely
              wrote on last edited by
              #6

              Quote:

              Both languages support the use of Unicode characters as variable names. Basically, you could use Emoticons or other non-ASCII characters as variable names if you want, but who does that anyway?

              Offshore teams trying to make it impossible for you to bring development back in house by using symbol names not just in a language you don't understand but in a character set your keyboard can't even type?

              Did you ever see history portrayed as an old man with a wise brow and pulseless heart, waging all things in the balance of reason? Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful? --Zachris Topelius Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies. -- Sarah Hoyt

              1 Reply Last reply
              0
              • J JMK NI

                He's not really comparing it with C# is he? He's comparing Swift with the parts of C# which are common to all C based languages, no mention of LINQ, Generics, ORM etc etc and their equivalents in Swift

                K Offline
                K Offline
                Kent Sharkey
                wrote on last edited by
                #7

                From the looks of things, this is part 1 of n, so just pure syntax for now.

                TTFN - Kent

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups