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. using file.

using file.

Scheduled Pinned Locked Moved C#
csharp
4 Posts 3 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.
  • J Offline
    J Offline
    jaraldumary
    wrote on last edited by
    #1

    Hi, why we need to use generic class in c#. reply me, thanx in advance....

    0 1 Reply Last reply
    0
    • J jaraldumary

      Hi, why we need to use generic class in c#. reply me, thanx in advance....

      0 Offline
      0 Offline
      0x3c0
      wrote on last edited by
      #2

      Type safety. Most of the casts which can cause errors are noticed by the compiler, not the runtime. This means that you will find it more difficult to compile (you'll get either warnings or errors.) Because of this, you won't need to do as many casts. These mean that you spend less time casting, and have to catch fewer exceptions. So speed is also a factor.

      OriginalGriffO 1 Reply Last reply
      0
      • 0 0x3c0

        Type safety. Most of the casts which can cause errors are noticed by the compiler, not the runtime. This means that you will find it more difficult to compile (you'll get either warnings or errors.) Because of this, you won't need to do as many casts. These mean that you spend less time casting, and have to catch fewer exceptions. So speed is also a factor.

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

        Good answer - can I throw in readability? It does make the resulting code easier to understand as well (or I think so).

        No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced. This message is made of fully recyclable Zeros and Ones

        "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

        0 1 Reply Last reply
        0
        • OriginalGriffO OriginalGriff

          Good answer - can I throw in readability? It does make the resulting code easier to understand as well (or I think so).

          No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced. This message is made of fully recyclable Zeros and Ones

          0 Offline
          0 Offline
          0x3c0
          wrote on last edited by
          #4

          I hadn't thought of that. Readability is another factor, though it doesn't directly affect execution speed

          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