C# Klassenbeschreibung. Wohin mit der Implementierung?

DKK007

PCGH-Community-Veteran(in)
Ich habe hier eine C# Klasse eines großen Integerdatentypes, die ich mit 2 Vergleichsfunktionen (MIN/MAX) erweitern soll.

Jedoch weiß ich nicht so wirklich, an welche Stelle mein Code soll.

UInt
Code:
[[COLOR=#00008b]Serializable]
[COLOR=#0000e0]public class [COLOR=#00008b]Min : [COLOR=#00008b]Binary<[COLOR=#00008b]ExpressionUInt, [COLOR=#00008b]ExpressionUInt> {

   [COLOR=#0000e0]public [COLOR=#00008b]Min([COLOR=#00008b]ExpressionUInt a, [COLOR=#00008b]ExpressionUInt b) : [COLOR=#00008b]base(a, b) {
   }

   [COLOR=#0000e0]public override uint [COLOR=#008b8b]Value() {
      [COLOR=#0000e0]return [COLOR=#00008b]Math.[COLOR=#008b8b]Min([COLOR=#800080]a.[COLOR=#008b8b]Value(), [COLOR=#800080]b.[COLOR=#008b8b]Value());
   }

   [COLOR=#0000e0]public override [COLOR=#00008b]ExpressionUInt [COLOR=#008b8b]Translate([COLOR=#00008b]TranslationContext ctx) {
      [COLOR=#0000e0]return new [COLOR=#00008b]Min([COLOR=#800080]a.[COLOR=#008b8b]Translate(ctx), [COLOR=#800080]b.[COLOR=#008b8b]Translate(ctx));
   }

   [COLOR=#0000e0]public override void [COLOR=#008b8b]Compile([COLOR=#00008b]ExecutionContext exec, [COLOR=#0000e0]bool retval) {
      [COLOR=#800080]a.[COLOR=#008b8b]Compile(exec, retval);
      [COLOR=#800080]b.[COLOR=#008b8b]Compile(exec, retval);
      [COLOR=#0000e0]if (retval) exec.[COLOR=#800080]codegen.[COLOR=#008b8b]Emit([COLOR=#00008b]OpCodes.[COLOR=#800080]Call,
         [COLOR=#0000e0]typeof([COLOR=#00008b]System.[COLOR=#00008b]Math).[COLOR=#008b8b]GetMethod([COLOR=#a31515]"Min", [COLOR=#0000e0]new [COLOR=#00008b]Type[] { [COLOR=#0000e0]typeof([COLOR=#0000e0]uint), [COLOR=#0000e0]typeof([COLOR=#0000e0]uint) }));
   }
}



UInt128
Code:
[[COLOR=#00008b]Serializable]
   [COLOR=#0000e0]public class [COLOR=#00008b]Min : [COLOR=#00008b]Binary<[COLOR=#00008b]ExpressionU128, [COLOR=#00008b]ExpressionU128> {

      [COLOR=#0000e0]public [COLOR=#00008b]Min([COLOR=#00008b]ExpressionU128 a, [COLOR=#00008b]ExpressionU128 b) : [COLOR=#00008b]base(a, b) {
      }

      [COLOR=#0000e0]public override [COLOR=#00008b]UInt128 [COLOR=#008b8b]Value() {
[COLOR=#007f00]//       return UInt128.Min(a.Value(), b.Value());[COLOR=#0000e0]throw new [COLOR=#00008b]Exception();
      }

      [COLOR=#0000e0]public override [COLOR=#00008b]ExpressionU128 [COLOR=#008b8b]Translate([COLOR=#00008b]TranslationContext ctx) {
         [COLOR=#0000e0]return new [COLOR=#00008b]Min([COLOR=#800080]a.[COLOR=#008b8b]Translate(ctx), [COLOR=#800080]b.[COLOR=#008b8b]Translate(ctx));
      }

      [COLOR=#0000e0]public override void [COLOR=#008b8b]Compile([COLOR=#00008b]ExecutionContext exec, [COLOR=#0000e0]bool retval) {
[COLOR=#007f00]//       a.Compile(exec, retval);[COLOR=#007f00]//       b.Compile(exec, retval);[COLOR=#007f00]//       if (retval) exec.codegen.Emit(OpCodes.Call,[COLOR=#007f00]//          typeof(UInt128).GetMethod("Min", new [] { typeof(UInt128), typeof(UInt128) }));}
   }

Es geht also darum, wohin die Implementierung für UInt128.Max hin muss.
 
Öhm so recht verstehe ich dein Problem nicht, sind doch alles abgeschlossene Methoden, kannst die doch irgendwo reinhaun (zwischen 2 Methoden, am Ende ..., am Anfang .., muss halt nur hinter dem 1. { und vor dem lezten } der Klasse sein
 
Problem hat sich gelöst. Es gab neben der ExpressionUint128 noch eine extra Uint128 Datei in einem anderen Unterordner.
Dort waren auch die anderen Funktionsimplementierungen drin.

Trotzdem vielen Dank für eure Mitarbeit.
 
Zurück