• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

Monday's fascinating C# quiz

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    Monday's fascinating C# quiz

    Code:
    class XYZ<T> { public static int Count; }
    
    class TestXYZ
    {
    static void Main()
    {
    Console.WriteLine (++XYZ<int>.Count); 
    Console.WriteLine (++XYZ<int>.Count); 
    Console.WriteLine (++XYZ<string>.Count); 
    Console.WriteLine (++XYZ<object>.Count); 
    }
    }
    Prints four numbers, what are they?


    If you don't know/care just call me a cretin.

    #2
    1
    2
    1
    1
    merely at clientco for the entertainment

    Comment


      #3
      Originally posted by DimPrawn View Post
      Code:
      class XYZ<T> { public static int Count; }
      
      class TestXYZ
      {
      static void Main()
      {
      Console.WriteLine (++XYZ<int>.Count); 
      Console.WriteLine (++XYZ<int>.Count); 
      Console.WriteLine (++XYZ<string>.Count); 
      Console.WriteLine (++XYZ<object>.Count); 
      }
      }
      Prints four numbers, what are they?


      If you don't know/care just call me a cretin.
      Not a code monkey so will just call you a cretin!

      I am sorry but I would have rejected this, where is your test exit report? where are your release notes? have you got a singed off production licence and acceptance into support? Have you done your knowledge transfer and training sessions?
      Originally posted by Stevie Wonder Boy
      I can't see any way to do it can you please advise?

      I want my account deleted and all of my information removed, I want to invoke my right to be forgotten.

      Comment


        #4
        Originally posted by eek View Post
        1
        2
        1
        1
        Looks plausible - That or:

        1
        1
        1
        1

        After all, it looks as if the object instances aren't being stored. So it's reasonable to assume that a new one is created on the fly each time.
        Work in the public sector? Read the IR35 FAQ here

        Comment


          #5
          Originally posted by eek View Post
          1
          2
          1
          1
          Well, done. Someone who understands that static data is shared between closed generic types of the same type only.

          Comment


            #6
            Originally posted by SimonMac View Post
            Not a code monkey so will just call you a cretin!

            I am sorry but I would have rejected this, where is your test exit report? where are your release notes? have you got a singed off production licence and acceptance into support? Have you done your knowledge transfer and training sessions?
            Are you sure you are at the same Clientco as me?
            merely at clientco for the entertainment

            Comment


              #7
              Feck me, takes me back to first year undergraduate days.
              Dim, don't you think a middle-aged man should be doing something more, er, high level?
              Hard Brexit now!
              #prayfornodeal

              Comment


                #8
                Originally posted by sasguru View Post
                Feck me, takes me back to first year undergraduate days.
                Dim, don't you think a middle-aged man should be doing something more, er, high level?
                You did a computer science degree

                That explains a lot....
                merely at clientco for the entertainment

                Comment


                  #9
                  Originally posted by sasguru View Post
                  Feck me, takes me back to first year undergraduate days.
                  Dim, don't you think a middle-aged man should be doing something more, er, high level?
                  I am, I've progressed to drag 'n' drop now.

                  Comment


                    #10
                    Originally posted by eek View Post
                    You did a computer science degree

                    That explains a lot....
                    I think the fact you didn't explains rather more.
                    Hard Brexit now!
                    #prayfornodeal

                    Comment

                    Working...
                    X