Inherit from class with same namespace

Is there any way to inherit from a class that exists in a referenced project and has the same namespace as the base class   For example, lets say I have a class with namespace MyApplication.Common in MyApplication.Base.dll.  Is there any way to create a class that inherits from MyApplication.Common and has the same namespace in a project that references MyApplication.Base.dll   I was hoping that partials might help me out, but they are limited to existing within the same project.

Thanks for any help.
Lance


Answer this question

Inherit from class with same namespace

  • double_metre

    Its working well in C# 2.0.
    Im sorry I couldnt show VB.net code.. I dont have it
    but it is possible to inherit the class from another project.


    namespace WindowsApplication1 {     class Class1:ClassLibrary1.Class1     {         public Class1()         {             this.IntegerInt;             base.IntegerInt;             this.Save();             base.Save();         }     } }
     


  • Derek McLachlan

    You can change the ROOTNAMESPACE in the project properties to the one that you like to have (i.e. the existing namespace name).
    Or You can clear it and then creating classes under any namespace  you need
    Like

    Namespace System.Windows.Forms

    Public Class MySampleForm
       Inherits System.Windows.Forms.Form

    End Class

    End Namespace



  • Inherit from class with same namespace