Click here to Skip to main content
15,921,028 members
Home / Discussions / C#
   

C#

 
QuestionStuck - trying to get going with C# Pin
JTmetoo30-Mar-12 8:48
JTmetoo30-Mar-12 8:48 
GeneralRe: Stuck - trying to get going with C# Pin
Not Active30-Mar-12 8:55
mentorNot Active30-Mar-12 8:55 
AnswerRe: Stuck - trying to get going with C# Pin
RobCroll30-Mar-12 14:32
RobCroll30-Mar-12 14:32 
Question#PRAGMA Pin
KUNWAR99930-Mar-12 8:44
KUNWAR99930-Mar-12 8:44 
AnswerRe: #PRAGMA Pin
RobCroll30-Mar-12 14:24
RobCroll30-Mar-12 14:24 
GeneralRe: #PRAGMA Pin
KUNWAR99930-Mar-12 22:23
KUNWAR99930-Mar-12 22:23 
GeneralRe: #PRAGMA Pin
Richard MacCutchan30-Mar-12 23:26
mveRichard MacCutchan30-Mar-12 23:26 
GeneralRe: #PRAGMA Pin
KUNWAR99930-Mar-12 23:39
KUNWAR99930-Mar-12 23:39 
GeneralRe: #PRAGMA Pin
Richard MacCutchan31-Mar-12 0:03
mveRichard MacCutchan31-Mar-12 0:03 
AnswerRe: #PRAGMA Pin
Luc Pattyn31-Mar-12 3:49
sitebuilderLuc Pattyn31-Mar-12 3:49 
GeneralRe: #PRAGMA Pin
Richard MacCutchan31-Mar-12 4:18
mveRichard MacCutchan31-Mar-12 4:18 
GeneralRe: #PRAGMA Pin
Pete O'Hanlon31-Mar-12 4:03
mvePete O'Hanlon31-Mar-12 4:03 
AnswerRe: #PRAGMA Pin
harold aptroot31-Mar-12 4:03
harold aptroot31-Mar-12 4:03 
QuestionChange the packet IP (source or destination) with Pcap.net Pin
falukky30-Mar-12 1:10
falukky30-Mar-12 1:10 
AnswerRe: Change the packet IP (source or destination) with Pcap.net Pin
Richard Andrew x6430-Mar-12 4:42
professionalRichard Andrew x6430-Mar-12 4:42 
GeneralRe: Change the packet IP (source or destination) with Pcap.net Pin
falukky30-Mar-12 5:03
falukky30-Mar-12 5:03 
GeneralRe: Change the packet IP (source or destination) with Pcap.net Pin
Richard Andrew x6430-Mar-12 5:08
professionalRichard Andrew x6430-Mar-12 5:08 
GeneralRe: Change the packet IP (source or destination) with Pcap.net Pin
falukky30-Mar-12 5:22
falukky30-Mar-12 5:22 
Questiondigit roundoff Pin
Member 823360130-Mar-12 0:46
Member 823360130-Mar-12 0:46 
AnswerRe: digit roundoff Pin
V.30-Mar-12 1:05
professionalV.30-Mar-12 1:05 
AnswerRe: digit roundoff Pin
JF201530-Mar-12 1:28
JF201530-Mar-12 1:28 
AnswerRe: digit roundoff Pin
ProEnggSoft30-Mar-12 3:36
ProEnggSoft30-Mar-12 3:36 
I want to add the following

What is required when the number is half i.e. 200.5. Whether 200 or 201?
By default Math.Round follows
MidpointRounding.ToEven enumeration value.
C#
double number = 200.5;
Console.WriteLine (Math.Round(number,0));
Console.WriteLine (Math.Round(number,0, MidpointRounding.AwayFromZero));
double number2 = 201.5;
Console.WriteLine (Math.Round(number2,0));
Console.WriteLine (Math.Round(number2,0, MidpointRounding.AwayFromZero));
//The output from the above code will be
//200
//201
//202
//202

So, if the next higher number is required always, when the value is half way, then
MidpointRounding.AwayFromZero is to be used.

modified 30-Mar-12 10:15am.

AnswerRe: digit roundoff Pin
KUNWAR99930-Mar-12 7:17
KUNWAR99930-Mar-12 7:17 
Questionmodifyable html control Pin
Ramkithepower30-Mar-12 0:16
Ramkithepower30-Mar-12 0:16 
AnswerRe: modifyable html control Pin
Eddy Vluggen30-Mar-12 8:02
professionalEddy Vluggen30-Mar-12 8:02 

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.