i want some encapsulation problem

int num;
num=int.parse(Console.Readline());

here i have a problem if user enter a string i get encapsulation how can i solve it in easiest way
my friends told me some function of try() ..catch() but I don't understood it

Thanks Sergey

Recommended Answers

All 4 Replies

Then have a look at the helpfile, it has a number of examples.

it's hard to understand it,
I don't know what to fill to Catch() parentness
and do i must use throw;

I want just to prevent of entering wrong data from user of my program

I mean :

int num;
num="ssss";

this cause encapsulation and I want to prevent it

If somebody can put some code here i will be glad to check it
Thanks Sergey

I guess your last post isnt enough .. you feel you need to ak the same question again?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.