Click here to Skip to main content
15,888,287 members
Home / Discussions / C#
   

C#

 
GeneralRe: how to deploy your software (set up) Pin
ago248619-Apr-18 21:48
ago248619-Apr-18 21:48 
GeneralRe: how to deploy your software (set up) Pin
Gerry Schmitz20-Apr-18 6:22
mveGerry Schmitz20-Apr-18 6:22 
GeneralRe: how to deploy your software (set up) Pin
ago248620-Apr-18 6:30
ago248620-Apr-18 6:30 
Questionconsolidating four similar classes Pin
Alexander Kindel16-Apr-18 15:23
Alexander Kindel16-Apr-18 15:23 
AnswerRe: consolidating four similar classes Pin
#realJSOP17-Apr-18 2:24
mve#realJSOP17-Apr-18 2:24 
GeneralRe: consolidating four similar classes Pin
Alexander Kindel17-Apr-18 11:34
Alexander Kindel17-Apr-18 11:34 
GeneralRe: consolidating four similar classes Pin
#realJSOP17-Apr-18 12:33
mve#realJSOP17-Apr-18 12:33 
GeneralRe: consolidating four similar classes Pin
Alexander Kindel17-Apr-18 16:53
Alexander Kindel17-Apr-18 16:53 
Are you thinking of a setup something like this (I would probably create a ModdedInteger class and use that instead of Integers plus a Characteristic field if I could make this approach work)?
C#
abstract class Polynomial<T> where T : IArithmetic<T>...
class IntegerPolynomial : Polynomial<Integer>, IArithmetic<IntegerPolynomial>...
class ModdedPolynomial : Polynomial<ModdedInteger>, IArithmetic<ModdedPolynomial>...
class RationalPolynomial : Polynomial<Rational>, IArithmetic<RationalPolynomial>...
class FieldElement : Polynomial<RationalPolynomial>, IArithmetic<FieldElement>...

The problem I've had with that is, suppose I'm trying to genericize the Integer.GetGCD/FieldElement.GetGCD algorithm to act on Polynomial objects. The only thing I can think to do with the signature is this:
C#
Polynomial<T> GetGCD<T>(Polynomial<T> a, Polynomial<T> b) where T : IArithmetic<T>

But then if I pass IntegerPolynomial objects, I get back a Polynomial<integer>, when what I really want is another IntegerPolynomial. I have the same problem with every other method that returns an object whose type is the same as the class it belongs to. I would have to extract the coefficients from the Polynomial object and use them to construct an object of the derived type I actually wanted almost every time I used any of them. This is why I mentioned considering the possibility of shoving everything into a single generic class - in that case I would be passing Polynomial<integer> objects, and the Polynomial<integer> object I'd get back would be exactly what I'd want.

In case you're inclined to play with it, here's the whole program.
GeneralRe: consolidating four similar classes Pin
#realJSOP19-Apr-18 2:50
mve#realJSOP19-Apr-18 2:50 
AnswerRe: consolidating four similar classes Pin
Gerry Schmitz18-Apr-18 7:05
mveGerry Schmitz18-Apr-18 7:05 
GeneralRe: consolidating four similar classes Pin
Alexander Kindel18-Apr-18 12:11
Alexander Kindel18-Apr-18 12:11 
GeneralRe: consolidating four similar classes Pin
Gerry Schmitz19-Apr-18 8:50
mveGerry Schmitz19-Apr-18 8:50 
QuestionC# Javascript in WebBrowser Pin
unfolded16-Apr-18 8:37
unfolded16-Apr-18 8:37 
AnswerRe: C# Javascript in WebBrowser Pin
Eddy Vluggen17-Apr-18 0:00
professionalEddy Vluggen17-Apr-18 0:00 
GeneralRe: C# Javascript in WebBrowser Pin
unfolded17-Apr-18 1:06
unfolded17-Apr-18 1:06 
GeneralRe: C# Javascript in WebBrowser Pin
Eddy Vluggen17-Apr-18 6:32
professionalEddy Vluggen17-Apr-18 6:32 
GeneralRe: C# Javascript in WebBrowser Pin
unfolded18-Apr-18 8:12
unfolded18-Apr-18 8:12 
AnswerRe: C# Javascript in WebBrowser Pin
Gerry Schmitz18-Apr-18 7:22
mveGerry Schmitz18-Apr-18 7:22 
GeneralRe: C# Javascript in WebBrowser Pin
unfolded18-Apr-18 8:10
unfolded18-Apr-18 8:10 
GeneralRe: C# Javascript in WebBrowser Pin
Gerry Schmitz18-Apr-18 8:59
mveGerry Schmitz18-Apr-18 8:59 
GeneralRe: C# Javascript in WebBrowser Pin
unfolded19-Apr-18 1:48
unfolded19-Apr-18 1:48 
GeneralRe: C# Javascript in WebBrowser Pin
Gerry Schmitz19-Apr-18 9:08
mveGerry Schmitz19-Apr-18 9:08 
QuestionWebBrowser script communication problem inside C # ActiveX Control Pin
SoulToMind15-Apr-18 22:01
SoulToMind15-Apr-18 22:01 
SuggestionRe: WebBrowser script communication problem inside C # ActiveX Control Pin
Richard MacCutchan15-Apr-18 22:28
mveRichard MacCutchan15-Apr-18 22:28 
GeneralRe: WebBrowser script communication problem inside C # ActiveX Control Pin
SoulToMind15-Apr-18 23:23
SoulToMind15-Apr-18 23:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.