Click here to Skip to main content
15,888,026 members
Home / Discussions / C#
   

C#

 
AnswerRe: Setup and deployment Pin
Ed.Poore17-Jun-08 6:03
Ed.Poore17-Jun-08 6:03 
QuestionCasting from Single to Int32 Pin
RugbyLeague16-Jun-08 22:49
RugbyLeague16-Jun-08 22:49 
AnswerRe: Casting from Single to Int32 Pin
N a v a n e e t h16-Jun-08 23:15
N a v a n e e t h16-Jun-08 23:15 
GeneralRe: Casting from Single to Int32 Pin
RugbyLeague16-Jun-08 23:19
RugbyLeague16-Jun-08 23:19 
GeneralRe: Casting from Single to Int32 Pin
N a v a n e e t h16-Jun-08 23:31
N a v a n e e t h16-Jun-08 23:31 
AnswerRe: Casting from Single to Int32 Pin
Anthony Mushrow16-Jun-08 23:46
professionalAnthony Mushrow16-Jun-08 23:46 
GeneralRe: Casting from Single to Int32 Pin
RugbyLeague16-Jun-08 23:55
RugbyLeague16-Jun-08 23:55 
GeneralRe: Casting from Single to Int32 Pin
Anthony Mushrow17-Jun-08 0:38
professionalAnthony Mushrow17-Jun-08 0:38 
I don't think there is...

I reckon the best you can do is check the float isn't too big, too small, ot is NaN. You could write up a little method:

public bool ConvertSingleToInt(float Single, out int Integer)
{
  Integer = 0;

  if(Single > int.MaxValue || Single < int.MinValue || float.IsNaN(Single) ) )
    return false;

  Integer = (int)Single;
  return true;
}


My current favourite word is: I'm starting to run out of fav. words!
-SK Genius

Game Programming articles start -here[^]-

GeneralRe: Casting from Single to Int32 Pin
RugbyLeague17-Jun-08 0:45
RugbyLeague17-Jun-08 0:45 
AnswerRe: Casting from Single to Int32 Pin
DaveyM6917-Jun-08 0:25
professionalDaveyM6917-Jun-08 0:25 
GeneralRe: Casting from Single to Int32 Pin
RugbyLeague17-Jun-08 0:42
RugbyLeague17-Jun-08 0:42 
AnswerRe: Casting from Single to Int32 Pin
Ashfield17-Jun-08 0:57
Ashfield17-Jun-08 0:57 
GeneralRe: Casting from Single to Int32 Pin
RugbyLeague17-Jun-08 0:58
RugbyLeague17-Jun-08 0:58 
GeneralRe: Casting from Single to Int32 Pin
Ashfield17-Jun-08 2:29
Ashfield17-Jun-08 2:29 
GeneralRe: Casting from Single to Int32 Pin
RugbyLeague17-Jun-08 2:32
RugbyLeague17-Jun-08 2:32 
GeneralRe: Casting from Single to Int32 Pin
Ashfield17-Jun-08 3:39
Ashfield17-Jun-08 3:39 
GeneralRe: Casting from Single to Int32 Pin
RugbyLeague17-Jun-08 3:42
RugbyLeague17-Jun-08 3:42 
QuestionCLSCompliantAttribute Pin
George_George16-Jun-08 22:21
George_George16-Jun-08 22:21 
Questioncompile error - I'm newbie Pin
ash poxon16-Jun-08 21:44
ash poxon16-Jun-08 21:44 
AnswerRe: compile error - I'm newbie Pin
Colin Angus Mackay16-Jun-08 21:48
Colin Angus Mackay16-Jun-08 21:48 
GeneralRe: compile error - I'm newbie Pin
ash poxon16-Jun-08 22:02
ash poxon16-Jun-08 22:02 
GeneralRe: compile error - I'm newbie Pin
Simon P Stevens16-Jun-08 22:38
Simon P Stevens16-Jun-08 22:38 
GeneralRe: compile error - I'm newbie Pin
ash poxon17-Jun-08 6:06
ash poxon17-Jun-08 6:06 
QuestionWriting string expression to command line .. .- How to do it ? Pin
Yanshof16-Jun-08 21:25
Yanshof16-Jun-08 21:25 
AnswerRe: Writing string expression to command line .. .- How to do it ? Pin
Colin Angus Mackay16-Jun-08 21:32
Colin Angus Mackay16-Jun-08 21:32 

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.