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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. The Lounge
  3. Quick C# quiz

Quick C# quiz

Scheduled Pinned Locked Moved The Lounge
csharphtmlquestion
45 Posts 15 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.
  • honey the codewitchH Offline
    honey the codewitchH Offline
    honey the codewitch
    wrote on last edited by
    #1

    foo("bar");

    does this refer to an invocation of the method foo? or an invocation of the delegate instance referred to by the variable or argument foo? *headdesk* C# is massively ambiguous without having type information, so now I get to write a visitor to "patch up" the code dom with type information. So basically i always create these expressions as delegate invocations, but then i have to go back through later and find types, so I can change the right ones to method invocations instead. I know C family languages require type information to parse (which is unfortunate) but C# takes it to another level. In for a penny, in for a pound I guess.

    When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

    OriginalGriffO Richard DeemingR P Sander RosselS J 9 Replies Last reply
    0
    • honey the codewitchH honey the codewitch

      foo("bar");

      does this refer to an invocation of the method foo? or an invocation of the delegate instance referred to by the variable or argument foo? *headdesk* C# is massively ambiguous without having type information, so now I get to write a visitor to "patch up" the code dom with type information. So basically i always create these expressions as delegate invocations, but then i have to go back through later and find types, so I can change the right ones to method invocations instead. I know C family languages require type information to parse (which is unfortunate) but C# takes it to another level. In for a penny, in for a pound I guess.

      When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #2

      honey the codewitch wrote:

      does this refer to an invocation of the method foo? or an invocation of the delegate instance referred to by the variable or argument foo?

      Neither: it means a VB programmer wants to access an array element and forgot where he was.

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony AntiTwitter: @DalekDave is now a follower!

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      honey the codewitchH S 2 Replies Last reply
      0
      • OriginalGriffO OriginalGriff

        honey the codewitch wrote:

        does this refer to an invocation of the method foo? or an invocation of the delegate instance referred to by the variable or argument foo?

        Neither: it means a VB programmer wants to access an array element and forgot where he was.

        "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony AntiTwitter: @DalekDave is now a follower!

        honey the codewitchH Offline
        honey the codewitchH Offline
        honey the codewitch
        wrote on last edited by
        #3

        lol, i'm glad my c# compiler doesn't see it that way. =)

        When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

        1 Reply Last reply
        0
        • honey the codewitchH honey the codewitch

          foo("bar");

          does this refer to an invocation of the method foo? or an invocation of the delegate instance referred to by the variable or argument foo? *headdesk* C# is massively ambiguous without having type information, so now I get to write a visitor to "patch up" the code dom with type information. So basically i always create these expressions as delegate invocations, but then i have to go back through later and find types, so I can change the right ones to method invocations instead. I know C family languages require type information to parse (which is unfortunate) but C# takes it to another level. In for a penny, in for a pound I guess.

          When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

          Richard DeemingR Offline
          Richard DeemingR Offline
          Richard Deeming
          wrote on last edited by
          #4

          honey the codewitch wrote:

          does this refer to an invocation of the method foo? or an invocation of the delegate instance referred to by the variable or argument foo?

          Yes. :)


          "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

          "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

          honey the codewitchH 1 Reply Last reply
          0
          • Richard DeemingR Richard Deeming

            honey the codewitch wrote:

            does this refer to an invocation of the method foo? or an invocation of the delegate instance referred to by the variable or argument foo?

            Yes. :)


            "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

            honey the codewitchH Offline
            honey the codewitchH Offline
            honey the codewitch
            wrote on last edited by
            #5

            you get an A and i get a headache

            When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

            OriginalGriffO 1 Reply Last reply
            0
            • honey the codewitchH honey the codewitch

              foo("bar");

              does this refer to an invocation of the method foo? or an invocation of the delegate instance referred to by the variable or argument foo? *headdesk* C# is massively ambiguous without having type information, so now I get to write a visitor to "patch up" the code dom with type information. So basically i always create these expressions as delegate invocations, but then i have to go back through later and find types, so I can change the right ones to method invocations instead. I know C family languages require type information to parse (which is unfortunate) but C# takes it to another level. In for a penny, in for a pound I guess.

              When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

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

              # define foo(x) this.GoToThe(x)

              Richard DeemingR 1 Reply Last reply
              0
              • honey the codewitchH honey the codewitch

                you get an A and i get a headache

                When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

                OriginalGriffO Offline
                OriginalGriffO Offline
                OriginalGriff
                wrote on last edited by
                #7

                Well, you can't say I never give you anything useful[^] :-D

                "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony AntiTwitter: @DalekDave is now a follower!

                "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
                "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

                1 Reply Last reply
                0
                • P PIEBALDconsult

                  # define foo(x) this.GoToThe(x)

                  Richard DeemingR Offline
                  Richard DeemingR Offline
                  Richard Deeming
                  wrote on last edited by
                  #8

                  Thankfully that doesn't work in C#. :) #define - C# Reference | Microsoft Docs[^]


                  "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                  "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

                  OriginalGriffO P 2 Replies Last reply
                  0
                  • Richard DeemingR Richard Deeming

                    Thankfully that doesn't work in C#. :) #define - C# Reference | Microsoft Docs[^]


                    "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                    OriginalGriffO Offline
                    OriginalGriffO Offline
                    OriginalGriff
                    wrote on last edited by
                    #9

                    Nor does

                    #define if while

                    :-D

                    "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony AntiTwitter: @DalekDave is now a follower!

                    "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
                    "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

                    L 1 Reply Last reply
                    0
                    • OriginalGriffO OriginalGriff

                      Nor does

                      #define if while

                      :-D

                      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony AntiTwitter: @DalekDave is now a follower!

                      L Offline
                      L Offline
                      Lost User
                      wrote on last edited by
                      #10

                      #define then { #define endif } lets make C really basic so anyone can do it Edit: more complete #define IF if ( #define THEN ) { #define ELSE } else { #define ENDIF }

                      this internet has become nothing but fake news. ... time to fix it, time to get back to the fax!

                      honey the codewitchH E 2 Replies Last reply
                      0
                      • Richard DeemingR Richard Deeming

                        Thankfully that doesn't work in C#. :) #define - C# Reference | Microsoft Docs[^]


                        "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

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

                        The C pre-processor works just fine with C# code.

                        B 1 Reply Last reply
                        0
                        • P PIEBALDconsult

                          The C pre-processor works just fine with C# code.

                          B Offline
                          B Offline
                          BillWoodruff
                          wrote on last edited by
                          #12

                          PIEBALDconsult wrote:

                          The C pre-processor works just fine with C# code.

                          That's very interesting; please say more.

                          «One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali

                          enhzflepE P 2 Replies Last reply
                          0
                          • B BillWoodruff

                            PIEBALDconsult wrote:

                            The C pre-processor works just fine with C# code.

                            That's very interesting; please say more.

                            «One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali

                            enhzflepE Offline
                            enhzflepE Offline
                            enhzflep
                            wrote on last edited by
                            #13

                            I wonder if the fact that the notion of successfully creating useful output isn't mentioned, is relevant? I'm sure it would be perfectly happy to tell you whereabouts the input file contained text that wasn't C compliant. In that case, I'd say that it did in fact work just fine with what you gave it. That you gave it C# when it has a dietary restriction that only allows it to consume C is irrelevant. The pre-processor still ran and exited without an error code, a crash or undefined behaviour. Reasonable people call them Semantics, others think that Symantec's is about tiny differences in language, rather than a word that implies ownership by the Symantec company.. Going to be interesting to see what the answer is on this one. :)

                            honey the codewitchH 1 Reply Last reply
                            0
                            • honey the codewitchH honey the codewitch

                              foo("bar");

                              does this refer to an invocation of the method foo? or an invocation of the delegate instance referred to by the variable or argument foo? *headdesk* C# is massively ambiguous without having type information, so now I get to write a visitor to "patch up" the code dom with type information. So basically i always create these expressions as delegate invocations, but then i have to go back through later and find types, so I can change the right ones to method invocations instead. I know C family languages require type information to parse (which is unfortunate) but C# takes it to another level. In for a penny, in for a pound I guess.

                              When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

                              Sander RosselS Offline
                              Sander RosselS Offline
                              Sander Rossel
                              wrote on last edited by
                              #14

                              honey the codewitch wrote:

                              does this refer to an invocation of the method foo? or an invocation of the delegate instance referred to by the variable or argument foo?

                              It's the latter which I know because of casing. If it were the former surely it would be Foo("bar"); :D Oh, but I forgot, style isn't important and we can forget about consistency. We write for compilers and they can read it just fine :doh:

                              Best, Sander sanderrossel.com Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly

                              honey the codewitchH 1 Reply Last reply
                              0
                              • Sander RosselS Sander Rossel

                                honey the codewitch wrote:

                                does this refer to an invocation of the method foo? or an invocation of the delegate instance referred to by the variable or argument foo?

                                It's the latter which I know because of casing. If it were the former surely it would be Foo("bar"); :D Oh, but I forgot, style isn't important and we can forget about consistency. We write for compilers and they can read it just fine :doh:

                                Best, Sander sanderrossel.com Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly

                                honey the codewitchH Offline
                                honey the codewitchH Offline
                                honey the codewitch
                                wrote on last edited by
                                #15

                                do you REALLY want me to enforce title casing for methods vs fields? because I can do that, and it makes my job a HELL of a lot easier.

                                When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

                                Sander RosselS P S 3 Replies Last reply
                                0
                                • enhzflepE enhzflep

                                  I wonder if the fact that the notion of successfully creating useful output isn't mentioned, is relevant? I'm sure it would be perfectly happy to tell you whereabouts the input file contained text that wasn't C compliant. In that case, I'd say that it did in fact work just fine with what you gave it. That you gave it C# when it has a dietary restriction that only allows it to consume C is irrelevant. The pre-processor still ran and exited without an error code, a crash or undefined behaviour. Reasonable people call them Semantics, others think that Symantec's is about tiny differences in language, rather than a word that implies ownership by the Symantec company.. Going to be interesting to see what the answer is on this one. :)

                                  honey the codewitchH Offline
                                  honey the codewitchH Offline
                                  honey the codewitch
                                  wrote on last edited by
                                  #16

                                  "Everything is exactly as useful as you make it." - Hacker lore "Everything is exactly as real as it is useful." - Honey the Monster. :cool:

                                  When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

                                  1 Reply Last reply
                                  0
                                  • L Lost User

                                    #define then { #define endif } lets make C really basic so anyone can do it Edit: more complete #define IF if ( #define THEN ) { #define ELSE } else { #define ENDIF }

                                    this internet has become nothing but fake news. ... time to fix it, time to get back to the fax!

                                    honey the codewitchH Offline
                                    honey the codewitchH Offline
                                    honey the codewitch
                                    wrote on last edited by
                                    #17

                                    I've killed for less

                                    When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

                                    1 Reply Last reply
                                    0
                                    • honey the codewitchH honey the codewitch

                                      do you REALLY want me to enforce title casing for methods vs fields? because I can do that, and it makes my job a HELL of a lot easier.

                                      When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

                                      Sander RosselS Offline
                                      Sander RosselS Offline
                                      Sander Rossel
                                      wrote on last edited by
                                      #18

                                      I was thinking of this conversation of a while back: The Lounge[^] Unfortunately, not everyone agreed with me and so they were wrong ;) I won't mention names (although it's quite easy to look up), but someone literally said "Style is not important because you're writing code for compiler to read, not for developers." And here you are wondering what the hell you're looking at while I would be absolutely sure (in my own code) because I CARE ABOUT STYLE! :cool: I wouldn't mind enforcing PascalCase for methods and camelCase for fields and variables :)

                                      Best, Sander sanderrossel.com Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly

                                      honey the codewitchH 1 Reply Last reply
                                      0
                                      • Sander RosselS Sander Rossel

                                        I was thinking of this conversation of a while back: The Lounge[^] Unfortunately, not everyone agreed with me and so they were wrong ;) I won't mention names (although it's quite easy to look up), but someone literally said "Style is not important because you're writing code for compiler to read, not for developers." And here you are wondering what the hell you're looking at while I would be absolutely sure (in my own code) because I CARE ABOUT STYLE! :cool: I wouldn't mind enforcing PascalCase for methods and camelCase for fields and variables :)

                                        Best, Sander sanderrossel.com Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly

                                        honey the codewitchH Offline
                                        honey the codewitchH Offline
                                        honey the codewitch
                                        wrote on last edited by
                                        #19

                                        I agree with SuperLloyd in that discussion. Context is everything.

                                        When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

                                        Sander RosselS 1 Reply Last reply
                                        0
                                        • honey the codewitchH honey the codewitch

                                          I agree with SuperLloyd in that discussion. Context is everything.

                                          When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

                                          Sander RosselS Offline
                                          Sander RosselS Offline
                                          Sander Rossel
                                          wrote on last edited by
                                          #20

                                          Message analysis complete. Found 1 error in "I agree with SuperLloyd" on line 1 column 0. Suggested fix: change "SuperLloyd" to "Sander". Compilation failed.

                                          Best, Sander sanderrossel.com Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly

                                          honey the codewitchH 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