Click here to Skip to main content
15,912,400 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: global variables Pin
sulabh20208-Aug-07 0:26
sulabh20208-Aug-07 0:26 
GeneralRe: global variables Pin
Archana New to Dotnet8-Aug-07 0:27
Archana New to Dotnet8-Aug-07 0:27 
GeneralRe: global variables Pin
Colin Angus Mackay8-Aug-07 0:34
Colin Angus Mackay8-Aug-07 0:34 
GeneralRe: global variables Pin
Archana New to Dotnet8-Aug-07 0:43
Archana New to Dotnet8-Aug-07 0:43 
GeneralRe: global variables Pin
N a v a n e e t h8-Aug-07 0:44
N a v a n e e t h8-Aug-07 0:44 
GeneralRe: global variables Pin
Pete O'Hanlon8-Aug-07 2:30
mvePete O'Hanlon8-Aug-07 2:30 
GeneralRe: global variables Pin
N a v a n e e t h8-Aug-07 2:37
N a v a n e e t h8-Aug-07 2:37 
GeneralRe: global variables Pin
Colin Angus Mackay8-Aug-07 9:09
Colin Angus Mackay8-Aug-07 9:09 
N a v a n e e t h wrote:
But I read some where like exposing class variables through properties is a bad habit


Actually, it is a very good habit. You may, presently, wish to allow direct access to the variables because the class doesn't care what outside entities set on the variable. But if you do that and then realise that in fact you need to fire off an event, or check the validity of the value then you can't do anything about it.

Properties are methods in reality. A property called Address will actually compile to get_Address() and set_Address(string value). So, by using properties now, even although you may not strictly need them now, saves problems later when you make the field private. You can easily add code to the method (that backs the property) because the public interface has not changed. It isn't so easy moving from public field to public property because they are not the same thing. (Even although in C# the look like the same thing)

Two blog entries of mine that might be of interest:
* Why make fields in a class private, why not just make them public?[^]
* The public fields debate again[^]


Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...

"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."


My website

GeneralRe: global variables Pin
N a v a n e e t h8-Aug-07 18:20
N a v a n e e t h8-Aug-07 18:20 
GeneralRe: global variables Pin
Colin Angus Mackay8-Aug-07 9:01
Colin Angus Mackay8-Aug-07 9:01 
AnswerRe: global variables Pin
Rasal doss Solomon8-Aug-07 0:58
Rasal doss Solomon8-Aug-07 0:58 
QuestionHow to compare username and password fields given by user in login page with database and redirecting him to the next corresponding page Pin
bhattiprolu7-Aug-07 23:57
bhattiprolu7-Aug-07 23:57 
AnswerRe: How to compare username and password fields given by user in login page with database and redirecting him to the next corresponding page Pin
Archana New to Dotnet8-Aug-07 0:32
Archana New to Dotnet8-Aug-07 0:32 
GeneralRe: How to compare username and password fields given by user in login page with database and redirecting him to the next corresponding page Pin
bhattiprolu8-Aug-07 0:37
bhattiprolu8-Aug-07 0:37 
GeneralRe: How to compare username and password fields given by user in login page with database and redirecting him to the next corresponding page Pin
bhattiprolu8-Aug-07 0:43
bhattiprolu8-Aug-07 0:43 
QuestionNeed a watermark imaging source code in asp.net 2.0 csharp Pin
harryforum7-Aug-07 23:43
harryforum7-Aug-07 23:43 
AnswerRe: Need a watermark imaging source code in asp.net 2.0 csharp Pin
sulabh20207-Aug-07 23:51
sulabh20207-Aug-07 23:51 
GeneralRe: Need a watermark imaging source code in asp.net 2.0 csharp Pin
harryforum8-Aug-07 0:17
harryforum8-Aug-07 0:17 
QuestionAdd different banner in header and footer using one admin section [modified] Pin
srakesh7-Aug-07 23:41
srakesh7-Aug-07 23:41 
QuestionAsp.net To Html Pin
A.Muthunagai7-Aug-07 23:40
A.Muthunagai7-Aug-07 23:40 
QuestionCSV + ASP.NET Pin
shweta@syscom7-Aug-07 23:04
shweta@syscom7-Aug-07 23:04 
AnswerRe: CSV + ASP.NET Pin
Vasudevan Deepak Kumar7-Aug-07 23:05
Vasudevan Deepak Kumar7-Aug-07 23:05 
GeneralRe: CSV + ASP.NET Pin
Brady Kelly7-Aug-07 23:14
Brady Kelly7-Aug-07 23:14 
GeneralRe: CSV + ASP.NET Pin
Vasudevan Deepak Kumar7-Aug-07 23:25
Vasudevan Deepak Kumar7-Aug-07 23:25 
GeneralRe: CSV + ASP.NET Pin
shweta@syscom8-Aug-07 0:50
shweta@syscom8-Aug-07 0:50 

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.