override Convert.ToInt32(String value)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zybernau
    New Member
    • Mar 2007
    • 34

    override Convert.ToInt32(String value)

    hi all,
    i need to override the function from convert.ToInt32 (String value).
    can you guys tell me wat are all the possible ways to do that.?

    thanks
    raj
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    What do you mean by override?
    You mean like how Int32.Parse() can take in extra parameters to allow for non-numerical characters?

    Comment

    • Curtis Rutland
      Recognized Expert Specialist
      • Apr 2008
      • 3264

      #3
      Well, you can't directly override it, because you can't derive from the Convert class. Static classes can only derive from Object, and non-static classes can't derive from static ones, which Convert is.

      You would have to write your own function to mimic this one.

      Comment

      • zybernau
        New Member
        • Mar 2007
        • 34

        #4
        Originally posted by insertAlias
        Well, you can't directly override it, because you can't derive from the Convert class. Static classes can only derive from Object, and non-static classes can't derive from static ones, which Convert is.

        You would have to write your own function to mimic this one.
        Thank you alias..
        i tried the same thing then flopped and now i'm settled with my own function
        changed the name from Convert.ToInt32 ("") to ConvertToInt32( "") :)

        Comment

        • Curtis Rutland
          Recognized Expert Specialist
          • Apr 2008
          • 3264

          #5
          Glad you figured it out.

          Comment

          Working...