[Request]Organized chat.cs?

03/09/2013 17:55 go for it#46
Quote:
Originally Posted by nTL3fTy View Post
[Only registered and activated users can see links. Click Here To Register...]?
[Only registered and activated users can see links. Click Here To Register...]?
[Only registered and activated users can see links. Click Here To Register...]?
[Only registered and activated users can see links. Click Here To Register...]?
[Only registered and activated users can see links. Click Here To Register...]?
[Only registered and activated users can see links. Click Here To Register...]?
[Only registered and activated users can see links. Click Here To Register...]?
[Only registered and activated users can see links. Click Here To Register...]?
[Only registered and activated users can see links. Click Here To Register...]?
[Only registered and activated users can see links. Click Here To Register...]?

i duno how this is related to what i was talking about , but maybe you mean that i should use tryparse instead of converting or parse so incase it failed it return a bool ?

when system convert return error it break the try block and does not set the bool to true
when the try parse fails it return false
same result ?

so instead of ONE try catch block i create THIRTY if/else with tryparse ?

try
{
switch
{
case when fail does not set the value to true
case when fail does not set the value to true
case when fail does not set the value to true
}
}
catch
{

}

but with try parse

switch
{
case
if(try parse){}
else{}

case
if(try parse){}
else{}

case
if(try parse){}
else{}

case
if(try parse){}
else{}

case
if(try parse){}
else{}

case
if(try parse){}
else{}

case
if(try parse){}
else{}

}


i don't think tryparse is better here , don't you think ?
i need that error to inform me that im doing something wrong and set the whole method to false , tryparse won't give me that error so ill need to handle it on each case , got my point ?
03/09/2013 20:24 lostsolder05#47
Quote:
Originally Posted by go for it View Post
i duno how this is related to what i was talking about , but maybe you mean that i should use tryparse instead of converting or parse so incase it failed it return a bool ?

when system convert return error it break the try block and does not set the bool to true
when the try parse fails it return false
same result ?

so instead of ONE try catch block i create THIRTY if/else with tryparse ?


i don't think tryparse is better here , don't you think ?
i need that error to inform me that im doing something wrong and set the whole method to false , tryparse won't give me that error so ill need to handle it on each case , got my point ?
TryParse is implemented without exceptions therefore it run's a lot faster... Did I mention it works as a bool? The only time you use a try/catch is when absolutely necessary you're not suppose to go throwing them everywhere you can.

@Arco Regardless of the poor example my point stands.
03/09/2013 20:30 go for it#48
Quote:
Originally Posted by lostsolder05 View Post
TryParse is implemented without exceptions therefore it run's a lot faster... Did I mention it works as a bool?

@Arco Regardless of the poor example my point stands.
how faster do you think it works ? does that milliseconds matters each time i type a command ?
as they say , if you care about cpu cycles then c# is definitely not for you

and nope you didn't but msdn did , but without using it as bool you won't even know if your conversion failed
which means that your code will be always true and it won't be bool which means you need to read what i said to acro in the very first post for me on this thread

edit:
as you edited your post i need to edit this one
Quote:
The only time you use a try/catch is when absolutely necessary you're not suppose to go throwing them everywhere you can.
well im not throwing them everywhere , but as i said in the prev. post "a try catch block in this example is way way way more efficient than a check on every case"

yes a try/catch block should not be used alot but in this example i think it's the easiest way to get it done
03/09/2013 20:34 _DreadNought_#49
It will only run milliseconds faster if that.

While it doesnt matter; it's good programming technique to make things as fast as possible.

Also - A try catch block ONLY causes a very small performance loss if an exception is actually thrown.
03/09/2013 21:21 xScylez#50
Quote:
Originally Posted by Fаng View Post
You know absolutely rats-ass about programming... and you're trying to maintain a private server? That sounds like a really bad idea to me. Aren't there already private servers out there that you can join and support?
That may be true, but i have a problem learning fast... I use time to learn :/ and is i said earlier, i am making this for me and some friends. :-)

EDIT: Got it fixed now... Oh my god, how didn't i see it! It wasn't that hard after all xD Thanks all!
#Close Thread!