Autor Beitrag
highlander78
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 62



BeitragVerfasst: Di 31.08.10 10:15 
Hallo

ich bekomme einen Fehler bei dieser Zeile :

ausblenden C#-Quelltext
1:
int Len16 = Convert.ToInt32(5 + ((Math.Ceiling((5 + p_Len) / 16)) * 16));					


Der Aufruf unterscheidet nicht eindeutig zwischen folgenden Methoden und Eigenschaften: "System.Math.Ceiling(double)" und "System.Math.Ceiling(decimal)"

Hat jemand einen Tip für mich..


Gruss
danielf
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1012
Erhaltene Danke: 24

Windows XP
C#, Visual Studio
BeitragVerfasst: Di 31.08.10 10:25 
Hallo,

die Ceiling Methode ist überladen und bietet die Datentypen double und decimal an als Parameter an. (5 + p_Len) / 16 kann er nicht eindeutig als double oder decimal identifizieren. Deshalb muss du es explizit angeben. Zum Beispiel mit (decimal) (( 5 + p_Len) / 16 )

Gruß
danielf
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1012
Erhaltene Danke: 24

Windows XP
C#, Visual Studio
BeitragVerfasst: Di 31.08.10 10:25 
Hallo,

die Ceiling Methode ist überladen und bietet die Datentypen double und decimal an als Parameter an. (5 + p_Len) / 16 kann er nicht eindeutig als double oder decimal identifizieren. Deshalb muss du es explizit angeben. Zum Beispiel mit (decimal) (( 5 + p_Len) / 16 )

Gruß
highlander78 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 62



BeitragVerfasst: Di 31.08.10 11:17 
Es ist eine decimalzahl.

Wie sollte die Zeile genau aussehen, mir raucht schon mein Kopf :-(


ausblenden C#-Quelltext
1:
int Len16 = Convert.ToInt32(5 + ((Math.Ceiling(decimal)((5 + p_Len) / 16)) * 16));					



so haut es nicht hin....


Gruss
danielf
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1012
Erhaltene Danke: 24

Windows XP
C#, Visual Studio
BeitragVerfasst: Di 31.08.10 11:21 
Die Klammerung passt nicht. Du hast die Ceiling-Methode mit (decimal) als Parameter aufgerufen.

Was du willst ist die Ceiling-Methode aufrufen und den Ausdruck casten.

ausblenden C#-Quelltext
1:
int Len16 = Convert.ToInt32(5 + ((Math.Ceiling((decimal)((5 + p_Len) / 16)) * 16);					


Gruß