✅ Multiple inheritance question
I have a partial class webform that is inheriting a base page class. Inside it there are multiple references to base methods.
I am required to make a similar one with ever so slightly different functionality that has to be in a separate aspx.
The question is can I use Multiple inheritance to avoid copy pasting the code over into the new one and making the changes? Is it possible to just inherit the partial and somehow access the base methods required for it to function?
S
sibber•396d ago
c# doesnt support multiple inheritance
thankfully
its hard to recommend what to do in a case like this without seeing the code
V
Vektor•396d ago
The gist of it is copy paste code but i am trying to find out if i can avoid copy pasting everything and doing it more elegantly.
The new webform that will provide the service is 99% identical to the old but it has it's own unique flares and features in a sense.
I can't make it inherit the old partial class which inherits the base since I don't think it will allow me to access the base methods right?
T
Tvde1•396d ago
You cannot make a class that inherits from two classes, but you can turn your existing form into a new 'base class' which contains the shared code, and make your two pages inherit from your base class
it's possible for a class to inherit from a class, which itself inherits from a diffrent class
possible:
not possible
V
Vektor•396d ago
okay cheers for the explanation and the to do it more elegantly i need to do a full refactor of the service which given the deadline of today is not possible for the release, for now copy pasta it is and future releases with the refactored version
T
Tvde1•396d ago
welcome to developer life!
V
Vektor•396d ago
A
Accord•395d ago
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
51KMembers
View on DiscordWant results from more Discord servers?
More Posts❔ How to automatically set version of project to know what version deployed on specific server?The problem is that there is bunch of clients with different versions of .net core and netfx projecthow to make a target that will disappear after shooting a couple of times this is my scripts i havebut it doesnt seem to want to destroy https://paste.mod.gg/mppnwkqnmukq/2❔ ✅ Choosing an appropriate data structureSo I have a list of objects and I want one in the list to be active and the rest to be inactive.
I ❔ Saving User DataI have it set up through properties, but I'm having a lot of trouble with showing it on other forms Unsupported statement value type: Microsoft.DotNet.DesignTools.Client.CodeDom.CodeBodyTextStatementhttps://github.com/Jordan-Belfort-88/Audio-Player-1.0/blob/master/Audio%20Player/Form1.Designer.cs
IAssert.Raises<> in xUnitI'm trying to create tests for certain events. However it seems that xUnit assumes that I use EventH❔ I have an API function and I want to know what exception it can throw. How can I do that?This is not said in the documentationAmbiguity between 2 things idk how to fixGot an error message all of a sudden saying this when everything was working perfect before so i und❔ Problem populating DatagridI'm trying to populate a datagrid where certain columns are populated with information that is read ❔ Avisynth script maker thingIm trying to make a script that creates AVS files for every file in a Directory based on a template.❔ How to work with Hwnd in c#I want to open programs using Process.Start but all those programs have empty MainWindowHandle and M❔ VS For Mac Code CoverageHas anyone figured out how to show which lines are covered after running unit tests in VS For Mac?✅ Run code in main thread after Task.Run completed?Hello, I have a long running void function that I execute in a separate thread by calling `Task.Run(❔ methodHello,
If I create a method, does the method know about things in the Main method? Or am I supposed ❔ Project structure1. In my Solution there should be only 1 Project right? Unless its a big App
2. I started using fo❔ how to use EF6 in library with no dependancy injection and no startup.csI used EF core power tools to generate DB Context and reverse engineer the models.
now I get an erro❔ HeadFirst Design PatternSo I started with this Book today. First problem starts with the Duck Project:
and when he tests h✅ EqualityComparerHello, anyone know of this code work ?
--> `EqualityComparer<ICollection<myclass>> .Default.Equals❔ error attaching script (unity)this error appears when trying to attach the script, does anyone know how to solve it?❔ i have an app that runs well on my pc but not on other pcsi have an app that runs well on my pc but on when i zip it and bring it to another pc the ui is all