Click here to Skip to main content
15,902,032 members
Home / Discussions / C#
   

C#

 
GeneralRe: Disconnected Datasets Pin
Heath Stewart8-May-04 20:18
protectorHeath Stewart8-May-04 20:18 
GeneralRe: Disconnected Datasets Pin
MrJJKoolJ9-May-04 6:44
MrJJKoolJ9-May-04 6:44 
GeneralRe: Disconnected Datasets Pin
Heath Stewart9-May-04 9:27
protectorHeath Stewart9-May-04 9:27 
GeneralDrawing 3D piechart(the 3D depth part) Pin
Alan Zhao8-May-04 9:07
Alan Zhao8-May-04 9:07 
Questiondataset data tostring??? Pin
gman448-May-04 9:07
gman448-May-04 9:07 
AnswerRe: dataset data tostring??? Pin
Heath Stewart8-May-04 20:14
protectorHeath Stewart8-May-04 20:14 
GeneralArrays of Structures in C# .net Beginner Pin
ProgrammerA8-May-04 8:34
ProgrammerA8-May-04 8:34 
GeneralRe: Arrays of Structures in C# .net Beginner Pin
Jeff Varszegi8-May-04 11:12
professionalJeff Varszegi8-May-04 11:12 
GeneralMessage Closed Pin
8-May-04 7:33
Oshada Athulathmudali8-May-04 7:33 
GeneralRe: Flickering Images Pin
Mazdak8-May-04 8:57
Mazdak8-May-04 8:57 
GeneralRe: Flickering Images Pin
Heath Stewart8-May-04 20:09
protectorHeath Stewart8-May-04 20:09 
GeneralXML Serialization Pin
Diego F.8-May-04 7:26
Diego F.8-May-04 7:26 
GeneralRe: XML Serialization Pin
Mazdak8-May-04 8:36
Mazdak8-May-04 8:36 
GeneralRe: XML Serialization Pin
Diego F.8-May-04 14:44
Diego F.8-May-04 14:44 
Generalaccessing a property through several classes Pin
cristina_tudor8-May-04 6:29
cristina_tudor8-May-04 6:29 
GeneralRe: accessing a property through several classes Pin
ian mariano8-May-04 6:35
ian mariano8-May-04 6:35 
You have to cast the object returned from your Class2 accessor:

((Class3)var2.x[index]).Myprop


To be safe, however, you can't be sure that x at the specified index will have an object instance:

Class3   c = (Class3)var2.x[index];
 
if (c != null)
{
   //   do something with c.Myprop;
}
else
{
   //   do something else, perhaps throw an exception.
}


Alternately, you can use the as keyword:

Class3   c = var2.x[index] as Class3;


Ian Mariano - Bliki | Blog


"We are all wave equations in the information matrix of the universe" - me

GeneralRe: accessing a property through several classes Pin
Meysam Mahfouzi8-May-04 6:46
Meysam Mahfouzi8-May-04 6:46 
GeneralRe: accessing a property through several classes Pin
ian mariano8-May-04 7:23
ian mariano8-May-04 7:23 
GeneralRe: accessing a property through several classes Pin
Meysam Mahfouzi8-May-04 6:38
Meysam Mahfouzi8-May-04 6:38 
GeneralRe: accessing a property through several classes Pin
Jeff Varszegi8-May-04 11:07
professionalJeff Varszegi8-May-04 11:07 
Generalchecklistbox Pin
alsalahy8-May-04 5:43
alsalahy8-May-04 5:43 
GeneralRe: checklistbox Pin
ian mariano8-May-04 6:40
ian mariano8-May-04 6:40 
GeneralClosing an open Task Manager window Pin
Nagendra Kamath K8-May-04 5:00
Nagendra Kamath K8-May-04 5:00 
GeneralRe: Closing an open Task Manager window Pin
ian mariano8-May-04 6:42
ian mariano8-May-04 6:42 
GeneralRe: Closing an open Task Manager window Pin
Heath Stewart8-May-04 20:04
protectorHeath Stewart8-May-04 20:04 

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.