From a couple of my Assemblys like AssemblyA, AssemblyB, AssemblyC, AssemblyD I am calling a method in AssemblyE
for example:
DialogHelper.DisplayComments( param1,2,3,4) ;
now for some of those assemblies and not all of them I need to have an Overloaded version of DisplayComments() method that takes one more new parameter that I want to pass to:
DialogHelper.DisplayComments(param1,2,3,4,"5") ;
So one way is what I did: create an overload and pass the value.
But I was wondering if in .NET and Obeject-Oriented world is there any other elegant way of doing this so I can pass this value to that Assembly and that method?
if you have the source code you better overload the DisplayComments method
otherwise (if they are not static methods) you can create an extension method that takes one more parameter
In OOP world overloading is already very elegant.
If you want to try something else, can add Optional parameters, like for example
DialogHelper.DisplayComments(string param1, int prm2, int prm3, int prm4, string paramOtional="5") ;
Good luck
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With