Click here to Skip to main content
15,895,667 members
Home / Discussions / C#
   

C#

 
AnswerRe: XmlTextReader Clean Up Pin
Scott Dorman28-Aug-07 5:05
professionalScott Dorman28-Aug-07 5:05 
QuestionVariable transfer between different .net Programs Pin
Der M28-Aug-07 4:29
Der M28-Aug-07 4:29 
AnswerRe: Variable transfer between different .net Programs Pin
led mike28-Aug-07 4:46
led mike28-Aug-07 4:46 
AnswerRe: Variable transfer between different .net Programs Pin
DavidNohejl28-Aug-07 5:44
DavidNohejl28-Aug-07 5:44 
GeneralRe: Variable transfer between different .net Programs Pin
Der M28-Aug-07 7:08
Der M28-Aug-07 7:08 
Questiondecimal values Pin
jon-8028-Aug-07 3:56
professionaljon-8028-Aug-07 3:56 
AnswerRe: decimal values Pin
Colin Angus Mackay28-Aug-07 4:13
Colin Angus Mackay28-Aug-07 4:13 
AnswerRe: decimal values Pin
Scott Dorman28-Aug-07 4:15
professionalScott Dorman28-Aug-07 4:15 
Try it like this:
C#
_balance += _amount + (amount * 0.1m);
The m (or M)tells the compiler to treat the number as a decimal value, without it the number is treated as a double.

The reason this is giving you an error is that there are no implicit conversions between floating-point types and the decimal type. A decimal denotes a 128-bit data type. Compared to floating-point types, the decimal type has a greater precision and a smaller range, which makes it suitable for financial and monetary calculations. The double keyword denotes a simple type that stores 64-bit floating-point values.


Scott.

—In just two days, tomorrow will be yesterday.

[Forum Guidelines] [Articles] [Blog]

GeneralRe: decimal values Pin
Colin Angus Mackay28-Aug-07 5:22
Colin Angus Mackay28-Aug-07 5:22 
GeneralRe: decimal values Pin
Scott Dorman28-Aug-07 7:12
professionalScott Dorman28-Aug-07 7:12 
QuestionCreating DLL's Pin
Dewald28-Aug-07 2:39
Dewald28-Aug-07 2:39 
AnswerRe: Creating DLL's Pin
led mike28-Aug-07 4:59
led mike28-Aug-07 4:59 
AnswerRe: Creating DLL's Pin
sthotakura28-Aug-07 5:26
sthotakura28-Aug-07 5:26 
QuestionThe "using" statements at the top of a .cs Pin
Vodstok28-Aug-07 2:32
Vodstok28-Aug-07 2:32 
AnswerRe: The "using" statements at the top of a .cs Pin
Martin#28-Aug-07 2:41
Martin#28-Aug-07 2:41 
GeneralRe: The "using" statements at the top of a .cs Pin
Vodstok28-Aug-07 2:46
Vodstok28-Aug-07 2:46 
AnswerRe: The "using" statements at the top of a .cs Pin
Spacix One28-Aug-07 2:42
Spacix One28-Aug-07 2:42 
GeneralRe: The "using" statements at the top of a .cs Pin
Scott Dorman28-Aug-07 4:19
professionalScott Dorman28-Aug-07 4:19 
GeneralRe: The "using" directives at the top of a .cs Pin
PIEBALDconsult28-Aug-07 6:58
mvePIEBALDconsult28-Aug-07 6:58 
GeneralRe: The "using" directives at the top of a .cs Pin
Scott Dorman28-Aug-07 7:00
professionalScott Dorman28-Aug-07 7:00 
AnswerRe: The "using" statements at the top of a .cs Pin
Mark Churchill28-Aug-07 3:11
Mark Churchill28-Aug-07 3:11 
AnswerRe: The "using" directives at the top of a .cs Pin
PIEBALDconsult28-Aug-07 6:36
mvePIEBALDconsult28-Aug-07 6:36 
GeneralRe: The "using" directives at the top of a .cs Pin
Scott Dorman28-Aug-07 7:16
professionalScott Dorman28-Aug-07 7:16 
GeneralRe: The "using" directives at the top of a .cs Pin
PIEBALDconsult28-Aug-07 8:31
mvePIEBALDconsult28-Aug-07 8:31 
GeneralRe: The "using" directives at the top of a .cs Pin
Vodstok28-Aug-07 9:01
Vodstok28-Aug-07 9:01 

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.