Click here to Skip to main content
15,922,155 members
Home / Discussions / C#
   

C#

 
Questioni want to make the fix sized text in text box(e.g 10 characters). Pin
maifs16-Sep-08 20:51
maifs16-Sep-08 20:51 
AnswerRe: i want to make the fix sized text in text box(e.g 10 characters). Pin
Ajay.k_Singh16-Sep-08 21:24
Ajay.k_Singh16-Sep-08 21:24 
GeneralRe: i want to make the fix sized text in text box(e.g 10 characters). Pin
maifs16-Sep-08 21:50
maifs16-Sep-08 21:50 
AnswerRe: i want to make the fix sized text in text box(e.g 10 characters). Pin
maifs16-Sep-08 21:48
maifs16-Sep-08 21:48 
QuestionZeno's paradox Pin
Angelinna16-Sep-08 19:11
Angelinna16-Sep-08 19:11 
AnswerRe: Zeno's paradox Pin
Guffa16-Sep-08 21:29
Guffa16-Sep-08 21:29 
GeneralRe: Zeno's paradox Pin
Angelinna17-Sep-08 22:57
Angelinna17-Sep-08 22:57 
AnswerRe: Zeno's paradox Pin
Alan Balkany17-Sep-08 4:17
Alan Balkany17-Sep-08 4:17 
Questionany idea about java and c# encryption Pin
prasadbuddhika16-Sep-08 18:58
prasadbuddhika16-Sep-08 18:58 
QuestionMails blocked in \Inetpub\mailroot\Queue Pin
yesu prakash16-Sep-08 17:56
yesu prakash16-Sep-08 17:56 
AnswerRe: Mails blocked in \Inetpub\mailroot\Queue Pin
N a v a n e e t h16-Sep-08 19:29
N a v a n e e t h16-Sep-08 19:29 
Questioncomparing two dataTables Pin
Twyce16-Sep-08 16:20
Twyce16-Sep-08 16:20 
AnswerRe: comparing two dataTables Pin
Syed Mehroz Alam16-Sep-08 21:12
Syed Mehroz Alam16-Sep-08 21:12 
GeneralRe: comparing two dataTables Pin
Twyce17-Sep-08 1:02
Twyce17-Sep-08 1:02 
GeneralRe: comparing two dataTables Pin
Twyce17-Sep-08 1:25
Twyce17-Sep-08 1:25 
GeneralRe: comparing two dataTables Pin
Syed Mehroz Alam17-Sep-08 6:57
Syed Mehroz Alam17-Sep-08 6:57 
GeneralRe: comparing two dataTables Pin
Twyce17-Sep-08 9:51
Twyce17-Sep-08 9:51 
QuestionTrouble understanding private vs public instance variables Pin
Lachdahnan716-Sep-08 16:02
Lachdahnan716-Sep-08 16:02 
I am still foggy on this concept. Let me explain what I grasp (or think I do) so far. I will use this code as reference:

class TestClass
{
   private int privVar = 5;
   public int PubVar = 3;
}

(I know I am missing some code, but Im trying to keep it simple)



A private instance variable can only be modified within the class it was declared in. Or, within the method it was declared in.

A Public instance var has the same rules but also can be accessed by using it this way:
TestClass testClass = new TestClass();
int x = testClass.PubVar();


All of the books and articles I have read say that using public instance variables can be dangerous. Its not that I dont believe them, I just dont understand where the harm lies. In my current view, it seems like a person would have to instantiate your class by accident somehow, then use the testClass.PubVar(); (or w/e they named it) without know it is yours and not theirs?

Maybe because I am still learning C# and dont know of other ways that you can harm your variable? The reason why I bring this up now is because I am taking on the Get() and Set() methods, and the logic behind them is really confusing me.

I hope I am being descriptive enough of my problem, I was hoping to avoid a huge wall of text but maintain as much clarity of my question as possible.

Thanks
AnswerRe: Trouble understanding private vs public instance variables Pin
Steve Echols16-Sep-08 19:17
Steve Echols16-Sep-08 19:17 
AnswerRe: Trouble understanding private vs public instance variables Pin
c242317-Sep-08 0:04
c242317-Sep-08 0:04 
Questionsample code using combo box database in mysql.. Pin
cutedrew16-Sep-08 14:16
cutedrew16-Sep-08 14:16 
QuestionC#, importing .CSV file to datatable Pin
mdwhite7616-Sep-08 11:17
mdwhite7616-Sep-08 11:17 
AnswerRe: C#, importing .CSV file to datatable Pin
MarkB77716-Sep-08 11:30
MarkB77716-Sep-08 11:30 
GeneralRe: C#, importing .CSV file to datatable Pin
mdwhite7616-Sep-08 12:03
mdwhite7616-Sep-08 12:03 
GeneralRe: C#, importing .CSV file to datatable Pin
MarkB77716-Sep-08 12:33
MarkB77716-Sep-08 12:33 

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.