Click here to Skip to main content
15,889,216 members
Home / Discussions / C#
   

C#

 
GeneralRe: Serializing \r\n read issue Pin
Richard Deeming6-Oct-17 8:07
mveRichard Deeming6-Oct-17 8:07 
GeneralRe: Serializing \r\n read issue Pin
jschell11-Oct-17 5:53
jschell11-Oct-17 5:53 
AnswerRe: Serializing \r\n read issue Pin
Gerry Schmitz7-Oct-17 6:02
mveGerry Schmitz7-Oct-17 6:02 
QuestionDecimal compare Pin
VK196-Oct-17 4:16
VK196-Oct-17 4:16 
AnswerRe: Decimal compare Pin
Richard Deeming6-Oct-17 4:49
mveRichard Deeming6-Oct-17 4:49 
SuggestionRe: Decimal compare Pin
Richard MacCutchan6-Oct-17 4:53
mveRichard MacCutchan6-Oct-17 4:53 
GeneralRe: Decimal compare Pin
Mycroft Holmes7-Oct-17 14:38
professionalMycroft Holmes7-Oct-17 14:38 
AnswerRe: Decimal compare Pin
Luc Pattyn6-Oct-17 4:53
sitebuilderLuc Pattyn6-Oct-17 4:53 
Hi,

you shouldn't use strings to solve numeric problems. Your problem arrises when ToString() returns just "1" and not "1.0". You could of course enforce the latter by specifying the string format you want, but that is not the right way, use the appropriate conversions or functions instead.

It seems you want the fractional part of a real (float or double or even decimal) number; I don't know any function that offers that straight away. One way to get that is by first getting the integer part (e.g. with Math.Floor or Math.Truncate) then take the difference. Another way could be to cast to integer, but then you might run into overflow situations.

If negative inputs are allowed, be careful to first specify what you want, and then check your code for it.

Smile | :)
Luc Pattyn [My Articles] Nil Volentibus Arduum

AnswerRe: Decimal compare Pin
C. David Johnson6-Oct-17 5:56
C. David Johnson6-Oct-17 5:56 
GeneralRe: Decimal compare Pin
Luc Pattyn6-Oct-17 6:06
sitebuilderLuc Pattyn6-Oct-17 6:06 
GeneralRe: Decimal compare Pin
C. David Johnson6-Oct-17 6:13
C. David Johnson6-Oct-17 6:13 
AnswerRe: Decimal compare Pin
Gerry Schmitz7-Oct-17 5:48
mveGerry Schmitz7-Oct-17 5:48 
QuestionDeserialization issue (Should be easy) Pin
C. David Johnson5-Oct-17 9:38
C. David Johnson5-Oct-17 9:38 
AnswerRe: Deserialization issue (Should be easy) Pin
Richard Deeming6-Oct-17 2:25
mveRichard Deeming6-Oct-17 2:25 
AnswerRe: Deserialization issue (Should be easy) Pin
C. David Johnson6-Oct-17 5:03
C. David Johnson6-Oct-17 5:03 
QuestionHeisenbug in program without async, etc. Pin
Alexander Kindel5-Oct-17 6:47
Alexander Kindel5-Oct-17 6:47 
AnswerRe: Heisenbug in program without async, etc. Pin
harold aptroot5-Oct-17 10:42
harold aptroot5-Oct-17 10:42 
GeneralRe: Heisenbug in program without async, etc. Pin
Alexander Kindel5-Oct-17 11:28
Alexander Kindel5-Oct-17 11:28 
GeneralRe: Heisenbug in program without async, etc. Pin
harold aptroot5-Oct-17 12:32
harold aptroot5-Oct-17 12:32 
GeneralRe: Heisenbug in program without async, etc. Pin
Alexander Kindel5-Oct-17 12:50
Alexander Kindel5-Oct-17 12:50 
GeneralRe: Heisenbug in program without async, etc. Pin
harold aptroot5-Oct-17 23:17
harold aptroot5-Oct-17 23:17 
GeneralRe: Heisenbug in program without async, etc. Pin
Alexander Kindel5-Oct-17 22:22
Alexander Kindel5-Oct-17 22:22 
QuestionHelp with a Windows Form Application parser Pin
Member 134478105-Oct-17 4:59
Member 134478105-Oct-17 4:59 
QuestionRe: Help with a Windows Form Application parser Pin
Eddy Vluggen7-Oct-17 3:13
professionalEddy Vluggen7-Oct-17 3:13 
AnswerRe: Help with a Windows Form Application parser Pin
Member 134478109-Oct-17 6:43
Member 134478109-Oct-17 6:43 

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.