Click here to Skip to main content
16,006,768 members
Home / Discussions / C#
   

C#

 
AnswerRe: Textbox C# Pin
Malcolm Smart4-Oct-07 20:53
Malcolm Smart4-Oct-07 20:53 
AnswerRe: Textbox C# Pin
taranjotk4-Oct-07 21:30
taranjotk4-Oct-07 21:30 
QuestionC# Textbox Pin
OlieColie4-Oct-07 13:34
OlieColie4-Oct-07 13:34 
AnswerRe: C# Textbox Pin
Luc Pattyn4-Oct-07 13:37
sitebuilderLuc Pattyn4-Oct-07 13:37 
AnswerRe: C# Textbox Pin
taranjotk4-Oct-07 21:32
taranjotk4-Oct-07 21:32 
Questionhelp me in using dataGrid in C# Pin
michaelqog4-Oct-07 13:19
michaelqog4-Oct-07 13:19 
QuestionC# Help please! Pin
humblepgmr4-Oct-07 13:00
humblepgmr4-Oct-07 13:00 
AnswerRe: C# Help please! Pin
Guffa4-Oct-07 13:12
Guffa4-Oct-07 13:12 
Try to write a more useful subject line, that says something about your question. We're in the C# forum, so mentioning that in the subject is quite superflous. Almost everyone that starts a thread here need help, so that doesn't do anything at all to distinguish your thread from others.

To get a reference of a specific type, just cast the object reference:

if (a is MyObject1) {
   MyObject1 a1 = (MyObject1)a;
   // do something with a1
}

or:

MyObject1 a1 = a as MyObject1;
if (a1 != null) {
   // do something with a1
}

As the reference has to be the exact type, there is no solution that handles any type. You have to write code to handle each type separately.

If the classes are supposed to work in a similar way, you might want to create a base class or an interface that defines some common methods, and make all the classes inherit the base class or interface. That way you can use a reference to the base class or the interface instead of a reference to the common base class Object.



---
single minded; short sighted; long gone;

GeneralRe: C# Help please! Pin
Christian Graus4-Oct-07 14:41
protectorChristian Graus4-Oct-07 14:41 
GeneralRe: C# Help please! Pin
Anthony Mushrow4-Oct-07 14:57
professionalAnthony Mushrow4-Oct-07 14:57 
GeneralRe: C# Help please! Pin
Christian Graus4-Oct-07 15:17
protectorChristian Graus4-Oct-07 15:17 
GeneralRe: C# Help please! Pin
Anthony Mushrow4-Oct-07 15:23
professionalAnthony Mushrow4-Oct-07 15:23 
AnswerRe: C# Help please! Pin
Guffa4-Oct-07 19:52
Guffa4-Oct-07 19:52 
QuestionComplex Regular Expression Pin
Skippums4-Oct-07 12:37
Skippums4-Oct-07 12:37 
AnswerRe: Complex Regular Expression Pin
MidwestLimey5-Oct-07 5:18
professionalMidwestLimey5-Oct-07 5:18 
GeneralRe: Complex Regular Expression Pin
Skippums5-Oct-07 5:36
Skippums5-Oct-07 5:36 
GeneralRe: Complex Regular Expression Pin
MidwestLimey5-Oct-07 6:08
professionalMidwestLimey5-Oct-07 6:08 
QuestionDownload File From Website With Login Pin
redfish344-Oct-07 11:39
redfish344-Oct-07 11:39 
AnswerRe: Download File From Website With Login Pin
Scott Dorman4-Oct-07 11:54
professionalScott Dorman4-Oct-07 11:54 
GeneralRe: Download File From Website With Login Pin
redfish344-Oct-07 12:24
redfish344-Oct-07 12:24 
GeneralRe: Download File From Website With Login Pin
Meysam Mahfouzi21-Sep-08 20:21
Meysam Mahfouzi21-Sep-08 20:21 
Questionparsing a string with DateTime.ParseExact Pin
dfn4-Oct-07 11:11
dfn4-Oct-07 11:11 
AnswerRe: parsing a string with DateTime.ParseExact Pin
Christian Graus4-Oct-07 11:34
protectorChristian Graus4-Oct-07 11:34 
AnswerRe: parsing a string with DateTime.ParseExact Pin
Luc Pattyn4-Oct-07 11:44
sitebuilderLuc Pattyn4-Oct-07 11:44 
AnswerRe: parsing a string with DateTime.ParseExact Pin
Scott Dorman4-Oct-07 11:51
professionalScott Dorman4-Oct-07 11:51 

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.