Click here to Skip to main content
15,914,410 members
Home / Discussions / C#
   

C#

 
AnswerRe: meta data for assembly Pin
Christian Graus9-May-08 1:03
protectorChristian Graus9-May-08 1:03 
GeneralRe: meta data for assembly Pin
George_George10-May-08 21:05
George_George10-May-08 21:05 
QuestionDebug C#-Code called from C++ Application via COM-Wrapper Pin
ieaeitsch8-May-08 23:19
ieaeitsch8-May-08 23:19 
QuestionArray Size Query Pin
AnthonyW8-May-08 23:17
AnthonyW8-May-08 23:17 
AnswerRe: Array Size Query Pin
Coding C#8-May-08 23:23
Coding C#8-May-08 23:23 
AnswerRe: Array Size Query Pin
phannon868-May-08 23:25
professionalphannon868-May-08 23:25 
GeneralRe: Array Size Query Pin
AnthonyW8-May-08 23:35
AnthonyW8-May-08 23:35 
QuestionReading a property from list of an object from given index Pin
Nais8-May-08 23:07
Nais8-May-08 23:07 
Hi,

I want to write a GENERIC method to retrieve a property from an object from the specified index.

For example, I have three classes as listed below . OrderHeader contains a list of OrderDetail and OrderDetail Contains a list of OrderItem.


public  class OrderItem<br />
    {<br />
        private int _itemId  ;<br />
<br />
        public int ItemId<br />
        {<br />
            get { return _itemId; }<br />
            set { _itemId = value; }<br />
        }<br />
        private string _ItemName ;<br />
<br />
        public string ItemName<br />
        {<br />
            get { return _ItemName; }<br />
            set { _ItemName = value; }<br />
        }<br />
    }<br />
<br />
<br />
public class OrderDetail<br />
    {<br />
<br />
        private IList<OrderItem> _orderItemList;<br />
        private int _orderDetailId;<br />
        private int _amount;<br />
<br />
        public IList<OrderItem> OrderItemList<br />
        {<br />
            get { return _orderItemList; }<br />
            set { _orderItemList = value; }<br />
        }<br />
<br />
        public int OrderDetailId<br />
        {<br />
            get { return _orderDetailId; }<br />
            set { _orderDetailId = value; }<br />
        }<br />
<br />
        public int Amount<br />
        {<br />
            get { return _amount; }<br />
            set { _amount = value; }<br />
        }<br />
    }<br />
<br />
 public class OrderHeader<br />
    {<br />
        private int _orderHeaderId;<br />
        private IList<OrderDetail> _orderDetailList;<br />
<br />
        public int OrderHeaderId<br />
        {<br />
            get { return _orderHeaderId; }<br />
            set { _orderHeaderId = value; }<br />
        }<br />
        <br />
        public  IList<OrderDetail> OrderDetailList<br />
        {<br />
            get { return _orderDetailList; }<br />
            set { _orderDetailList = value; }<br />
        }<br />
   <br />
    }




First input to the method is an object (Example: OrderHeader Object)
Second input is a string with the required propety name and stirng. --> "OrderHeaderObject.OrderDetailList[1].OrderItemList[0].ItemName".

And the output should be the ItemName string.

What would the best way to acheive this..?
Can i achive it by using the method InvokeMember() method..? Example: OrderHeaderObject.GetType().InvokeMember(....)

Where did error begin? Smile | :)
-- Naison Garvasis Pekkattil

Questionhow to get text within <iframe> in .net with c#</iframe> Pin
sugunavathysubramanian8-May-08 22:56
sugunavathysubramanian8-May-08 22:56 
AnswerRe: how to get text within in .net with c# Pin
phannon868-May-08 23:00
professionalphannon868-May-08 23:00 
GeneralRe: how to get text within in .net with c# Pin
sugunavathysubramanian8-May-08 23:07
sugunavathysubramanian8-May-08 23:07 
QuestionDesign display problem in c# Pin
selvarajanlatha8-May-08 22:40
selvarajanlatha8-May-08 22:40 
AnswerRe: Design display problem in c# Pin
Gareth H8-May-08 22:50
Gareth H8-May-08 22:50 
QuestionHow to set search provider to my browser in c#.net ? Pin
Thirukkumaran8-May-08 21:50
Thirukkumaran8-May-08 21:50 
AnswerRe: How to set search provider to my browser in c#.net ? Pin
Vikram A Punathambekar8-May-08 22:25
Vikram A Punathambekar8-May-08 22:25 
QuestionRemoting Exception...Am i solving it correct.......? Pin
Siddharth Rastogi8-May-08 21:03
Siddharth Rastogi8-May-08 21:03 
AnswerRe: ASP.NET Question Pin
Gareth H8-May-08 22:48
Gareth H8-May-08 22:48 
GeneralRe: ASP.NET Question Pin
Siddharth Rastogi8-May-08 22:53
Siddharth Rastogi8-May-08 22:53 
QuestionCrystal report viewer toolbar Print button event PinPopular
AbhijeetB8-May-08 21:01
AbhijeetB8-May-08 21:01 
Questioncan anyone help me out? Pin
cristi_alonso8-May-08 20:54
cristi_alonso8-May-08 20:54 
QuestionReportViewer Pin
_str_618-May-08 19:55
_str_618-May-08 19:55 
QuestionDom Inspector assistance [modified] Pin
binaryDigit@@8-May-08 18:25
binaryDigit@@8-May-08 18:25 
AnswerRe: Dom Inspector assistance Pin
binaryDigit@@9-May-08 7:49
binaryDigit@@9-May-08 7:49 
Questionis this coding correct? Pin
Thomas Toh8-May-08 17:00
Thomas Toh8-May-08 17:00 
AnswerRe: is this coding correct? PinPopular
Christian Graus8-May-08 17:14
protectorChristian Graus8-May-08 17:14 

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.