Don't know if this can even be done or if my thinking is way off but I'll try to explain what I would like to do.
I've got a class called "Issue"; it holds properties for a Help Desk Issue (IssueID, UserID, IssueTypeID, etc.). I have a need in the code-behind to store the "string" values of these properties at any time. I originally thought of a simple stored procedure that would go out and return the string value but I have close to 15+ properties of the "int" type that are ID's and that would make for a lot of SP calls and DB hits.
So I was wondering if there's a way to override the ToString() method of any of my int type properties so I can handle it once in there. Pseudo Code might look something like:
Then in code elsewhere it would be:
So the variable IssueType would have the string value of "test".
Make any sense? From a programming standpoint, does it make any sense to try to accomplish this? Can it be done?
Thanks for any info & help!
I've got a class called "Issue"; it holds properties for a Help Desk Issue (IssueID, UserID, IssueTypeID, etc.). I have a need in the code-behind to store the "string" values of these properties at any time. I originally thought of a simple stored procedure that would go out and return the string value but I have close to 15+ properties of the "int" type that are ID's and that would make for a lot of SP calls and DB hits.
So I was wondering if there's a way to override the ToString() method of any of my int type properties so I can handle it once in there. Pseudo Code might look something like:
Code:
public int UserID {get; set;}
public int IssueTypeID {get; set;}
public override int ToString()
{
//code here to override the int.
return "test";
}
Then in code elsewhere it would be:
Code:
string IssueType = oIssue.IssueTypeID.ToString();
So the variable IssueType would have the string value of "test".
Make any sense? From a programming standpoint, does it make any sense to try to accomplish this? Can it be done?
Thanks for any info & help!