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. General Programming
  3. C#
  4. Static in C# 1.1

Static in C# 1.1

Scheduled Pinned Locked Moved C#
questioncsharpcareer
9 Posts 7 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.
  • S Offline
    S Offline
    sris 426
    wrote on last edited by
    #1

    Dear all, I have a interview question here-- Q ) We do not have static concept in dot net 1.1,so to achieve static in 1.1 , what was the solution? Thanks in advance, Srinivas Mateti

    L P P N 4 Replies Last reply
    0
    • S sris 426

      Dear all, I have a interview question here-- Q ) We do not have static concept in dot net 1.1,so to achieve static in 1.1 , what was the solution? Thanks in advance, Srinivas Mateti

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

      Singleton design pattern

      S 1 Reply Last reply
      0
      • L Lost User

        Singleton design pattern

        S Offline
        S Offline
        sris 426
        wrote on last edited by
        #3

        Thanks..a class with private constructor and one of parameter will creates the object of that class which is read only right..... So..is the question is rigt..."Dot net 1.1 does nt have static concept?

        P L D 3 Replies Last reply
        0
        • S sris 426

          Thanks..a class with private constructor and one of parameter will creates the object of that class which is read only right..... So..is the question is rigt..."Dot net 1.1 does nt have static concept?

          P Offline
          P Offline
          Pete OHanlon
          wrote on last edited by
          #4

          It allows static instances, but not static classes. This basically means that the static keyword wasn't applied to classes until .NET 2; it was available as a method modifier in .NET 1/1.1 which is how the static effect was achieved.

          "WPF has many lovers. It's a veritable porn star!" - Josh Smith

          As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

          My blog | My articles | MoXAML PowerToys | Onyx

          1 Reply Last reply
          0
          • S sris 426

            Thanks..a class with private constructor and one of parameter will creates the object of that class which is read only right..... So..is the question is rigt..."Dot net 1.1 does nt have static concept?

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

            Initial version of C# (.NET 1.1) did not support the concept of static classes though you could have static members in a class. C# 2.0 (.NET 2.0) introduced the concept of static classes. It is not a feature of the framework, it's just a syntactic sugar in the language which ensures that a class contains only static members, if that is what it is supposed to contain. Static classes cannot have non-static members (they can have const's), they cannot inherit from another class (implicitly inherits from System.Object) and they themselves cannot be inherited.

            1 Reply Last reply
            0
            • S sris 426

              Thanks..a class with private constructor and one of parameter will creates the object of that class which is read only right..... So..is the question is rigt..."Dot net 1.1 does nt have static concept?

              D Offline
              D Offline
              Dave Kreskowiak
              wrote on last edited by
              #6

              Static does not mean "read only". You can get a more comprehensive explanation from here[^].

              A guide to posting questions on CodeProject[^]
              Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                   2006, 2007, 2008
              But no longer in 2009...

              1 Reply Last reply
              0
              • S sris 426

                Dear all, I have a interview question here-- Q ) We do not have static concept in dot net 1.1,so to achieve static in 1.1 , what was the solution? Thanks in advance, Srinivas Mateti

                P Offline
                P Offline
                Paulo Zemek
                wrote on last edited by
                #7

                The question is wrong, as static is a modifier available in .Net since it's first version. Look at the Main method: static void Main(string[] args) { } It's static. But, as the others pointed, the keyword couldn't be used in the class declaration.

                1 Reply Last reply
                0
                • S sris 426

                  Dear all, I have a interview question here-- Q ) We do not have static concept in dot net 1.1,so to achieve static in 1.1 , what was the solution? Thanks in advance, Srinivas Mateti

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

                  Write a sealed class with a private constructor and only static members.

                  1 Reply Last reply
                  0
                  • S sris 426

                    Dear all, I have a interview question here-- Q ) We do not have static concept in dot net 1.1,so to achieve static in 1.1 , what was the solution? Thanks in advance, Srinivas Mateti

                    N Offline
                    N Offline
                    Natza Mitzi
                    wrote on last edited by
                    #9

                    There are static element in .NET 1.1 but no static classes. I used to use abstract classes instead of static classes. Some people might say its not clean yet it did the job.

                    Natza Mitzi Analysis Studio Statistical Analysis Software

                    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