Click here to Skip to main content
15,890,947 members
Home / Discussions / C#
   

C#

 
GeneralRe: Writing values from ArrayList into a text box Pin
Rizwan Rathore7-May-06 10:23
Rizwan Rathore7-May-06 10:23 
GeneralRe: Writing values from ArrayList into a text box Pin
Rizwan Rathore7-May-06 23:29
Rizwan Rathore7-May-06 23:29 
GeneralRe: Writing values from ArrayList into a text box Pin
J4amieC7-May-06 23:42
J4amieC7-May-06 23:42 
GeneralRe: Writing values from ArrayList into a text box Pin
Rizwan Rathore7-May-06 23:54
Rizwan Rathore7-May-06 23:54 
QuestionListView.Items.ContainsKey ?? Pin
student_rhr7-May-06 7:09
student_rhr7-May-06 7:09 
AnswerRe: ListView.Items.ContainsKey ?? Pin
Larantz7-May-06 8:32
Larantz7-May-06 8:32 
GeneralRe: ListView.Items.ContainsKey ?? Pin
student_rhr7-May-06 10:08
student_rhr7-May-06 10:08 
QuestionReflection Problem ! Pin
User 20930737-May-06 6:35
User 20930737-May-06 6:35 
Dear Friends,
assume the following namespace:

namespace MyNameSpace
 {
	public struct MyStruct
	{
          private int intVar;

          public int IntVar
           {
            get { return intVar; }
            set { intVar = value; }
           }
        }

        public class MyClass
        {
            private MyStruct structVar;
            //Public property.
            public MyStruct StructVar
            {
                get { return structVar; }
                set { structVar = value; }
            }
            public MyClass()
            {
            }
        }
}
}


This class is in a dll file (MyAssembly.dll).I wanna load this dll at runtime by reflection and change the IntVar property of StructVar of my class instance by SetValue method of PropertyInfo class.

namespace MyApplication
{
    public class MainClass
    {
        public void ChangeProperty()
        {
            Assembly asm = Assembly.LoadFrom("MyAssembly.dll");
            Type t = asm.GetType("MyNamespace.MyClass");
            PropertyInfo pInfo = t.GetProperty("StructVar");
            <font color="red">//Here is my problem.How can I change 'IntVar' member of this structure instance of MyClass ?
</font>            
            pInfo.SetValue(???);
        }
    }
}


Note that this class is in a seperate dll.
Best Regards.

[ _ Always there is another way _ ]
AnswerRe: Reflection Problem ! Pin
rudy.net7-May-06 7:23
rudy.net7-May-06 7:23 
GeneralRe: Reflection Problem ! Pin
User 20930737-May-06 18:26
User 20930737-May-06 18:26 
AnswerRe: Reflection Problem ! Pin
Stefan Troschuetz7-May-06 7:32
Stefan Troschuetz7-May-06 7:32 
GeneralRe: Reflection Problem ! Pin
S. Senthil Kumar7-May-06 7:39
S. Senthil Kumar7-May-06 7:39 
GeneralRe: Reflection Problem ! Pin
Stefan Troschuetz7-May-06 8:12
Stefan Troschuetz7-May-06 8:12 
AnswerRe: Reflection Problem ! Pin
S. Senthil Kumar7-May-06 7:36
S. Senthil Kumar7-May-06 7:36 
GeneralRe: Reflection Problem ! Pin
User 20930737-May-06 20:55
User 20930737-May-06 20:55 
Questioninsert into error Pin
Susuko7-May-06 5:52
Susuko7-May-06 5:52 
AnswerRe: insert into error Pin
Shajeel7-May-06 22:06
Shajeel7-May-06 22:06 
GeneralRe: insert into error Pin
Susuko8-May-06 10:18
Susuko8-May-06 10:18 
QuestionFiltering records in a DataGrid Pin
ventomito7-May-06 4:08
ventomito7-May-06 4:08 
AnswerRe: Filtering records in a DataGrid Pin
rudy.net7-May-06 4:30
rudy.net7-May-06 4:30 
GeneralRe: Filtering records in a DataGrid Pin
ventomito7-May-06 5:07
ventomito7-May-06 5:07 
GeneralRe: Filtering records in a DataGrid Pin
Sean897-May-06 5:32
Sean897-May-06 5:32 
GeneralRe: Filtering records in a DataGrid Pin
ventomito7-May-06 5:53
ventomito7-May-06 5:53 
GeneralRe: Filtering records in a DataGrid Pin
Sean897-May-06 6:01
Sean897-May-06 6:01 
GeneralRe: Filtering records in a DataGrid Pin
ventomito7-May-06 6:50
ventomito7-May-06 6:50 

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.