Click here to Skip to main content
15,896,557 members
Home / Discussions / C#
   

C#

 
AnswerRe: Binding CSV to CheckBoxList Pin
leppie3-Jun-08 18:31
leppie3-Jun-08 18:31 
QuestionErrorprovider in combination with tabs Pin
wilberts3-Jun-08 11:38
wilberts3-Jun-08 11:38 
QuestionDisabled keyboard and mouse Pin
hendryck3-Jun-08 11:03
hendryck3-Jun-08 11:03 
AnswerRe: Disabled keyboard and mouse Pin
DaveyM693-Jun-08 11:56
professionalDaveyM693-Jun-08 11:56 
GeneralRe: Disabled keyboard and mouse Pin
anujarya_20013-Jun-08 18:46
anujarya_20013-Jun-08 18:46 
GeneralRe: Disabled keyboard and mouse Pin
Shree3-Jun-08 19:46
Shree3-Jun-08 19:46 
AnswerRe: Disabled keyboard and mouse Pin
Nouman Bhatti3-Jun-08 19:44
Nouman Bhatti3-Jun-08 19:44 
QuestionValidating a property on Set Pin
martin_hughes3-Jun-08 9:35
martin_hughes3-Jun-08 9:35 
My ability to google and comprehend things today appears to be not what it should - I've been up since 4am so go easy on me Smile | :)

Anyway, suppose I have a very simple class with a single property:

public string SiteName { 
       get{return siteName;} 
       set{siteName = value;} 
}


Now SiteName has some very specific format requirements (ie not longer than 12 characters, first 4 chars are alpha only for example). Within the setter I can do some validation with a regex or whatever, and for validating this single property everything is great. It also seems to make sense to me that this is where the validation should take place.

However, it occurs to me that I might want to do a similar kind of validation on another property, perhaps even within in a separate class - or even multiple classes, and could get very messy with the same (or very similar) logic appearing all over the place. This looks to me like an ideal candidate for re-factoring... and this is where my googling has come unstuck!

What I'm really after is an insight on to tried an trusted techniques for validating properties, and also whether my intent is actually going to cause bigger problems than they're worth. I had a quick read about Custom Attributes, but I was not particularly clear on how to hook these up to know when a property is being modified, or how they interact with the property in question...

As always, any help greatly appreciated.


AnswerRe: Validating a property on Set Pin
Pete O'Hanlon3-Jun-08 9:44
mvePete O'Hanlon3-Jun-08 9:44 
GeneralRe: Validating a property on Set Pin
martin_hughes3-Jun-08 10:11
martin_hughes3-Jun-08 10:11 
GeneralRe: Validating a property on Set Pin
Pete O'Hanlon3-Jun-08 10:25
mvePete O'Hanlon3-Jun-08 10:25 
GeneralRe: Validating a property on Set Pin
anujarya_20013-Jun-08 18:21
anujarya_20013-Jun-08 18:21 
Questionhandle javaScript errors ? Pin
Rami Shareef3-Jun-08 7:12
Rami Shareef3-Jun-08 7:12 
AnswerRe: handle javaScript errors ? Pin
Scott Dorman3-Jun-08 7:16
professionalScott Dorman3-Jun-08 7:16 
GeneralRe: handle javaScript errors ? Pin
Rami Shareef3-Jun-08 7:19
Rami Shareef3-Jun-08 7:19 
GeneralRe: handle javaScript errors ? Pin
Scott Dorman3-Jun-08 7:27
professionalScott Dorman3-Jun-08 7:27 
GeneralRe: handle javaScript errors ? Pin
anujarya_20013-Jun-08 18:20
anujarya_20013-Jun-08 18:20 
GeneralRe: handle javaScript errors ? Pin
anujarya_20013-Jun-08 18:32
anujarya_20013-Jun-08 18:32 
GeneralRe: handle javaScript errors ? Pin
Shree3-Jun-08 19:50
Shree3-Jun-08 19:50 
QuestionWeb Service, I am missing something Pin
zaboboa3-Jun-08 6:59
zaboboa3-Jun-08 6:59 
AnswerRe: Web Service, I am missing something Pin
zaboboa3-Jun-08 7:44
zaboboa3-Jun-08 7:44 
QuestionIs there a way to document overloaded methods Pin
Clive D. Pottinger3-Jun-08 6:40
Clive D. Pottinger3-Jun-08 6:40 
AnswerWhats wrong with that method Pin
Ennis Ray Lynch, Jr.3-Jun-08 6:50
Ennis Ray Lynch, Jr.3-Jun-08 6:50 
GeneralRe: Whats wrong with that method Pin
Clive D. Pottinger3-Jun-08 7:14
Clive D. Pottinger3-Jun-08 7:14 
GeneralRe: Whats wrong with that method Pin
Ennis Ray Lynch, Jr.3-Jun-08 7:18
Ennis Ray Lynch, Jr.3-Jun-08 7:18 

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.