|
This has been done in Reflector, what you will want to do is load the assembly, from that call GetTypes() and iterate through each type. Within each type you will want to look at classes such as MethodInfo , ConstructorInfo , FieldInfo , etc. There are methods within the Type class that will return object arrays of these types.
- Nick Parker My Blog | My Articles
|
|
|
|
|
I would like to do this in the same code (not from an assembly). I certainly can use FieldInfo to see the root objects fields and data, but then I need to move into the contained object. Thats where I am stuck.
Type t = o.GetType();
FieldInfo[] fi = t.GetFields();
foreach (FieldInfo field in fi)
{
Console.WriteLine("Field: {0}\tType: {1}", field.Name, field.FieldType);
}
But, now....how to reflect into the "fields"?
Tony
|
|
|
|
|
|
GetValue returns an object reference. Then how to drill down into contained classes. I have had this questions too.
|
|
|
|
|
|
I've got a custom control which has quite a few properties, and they are all stuck under misc.
I'm sure i read somewhere that they could be set to their own, or an already existing titled section by using an attribute, but i can't find where i read it, or any attributes which look like they might do the job.
Can anyone help me?
Cheers
Cata
|
|
|
|
|
|
I'm trying to begin programming Managed Direct3D with C#.
But whatever I do it won't work.
Not even the sample projects wich come with the SDK won't run.
The error i get is the following:
An unhandled exception of type 'System.NullReferenceException' occurred in microsoft.directx.direct3d.dll
Additional information: Object reference not set to an instance of an object.
It gives the error on the following statment:
device = new Device(0, DeviceType.Hardware, this, CreateFlags.SoftwareVertexProcessing, presentParams);
If i catch the NullReferenceException and make the program continue as if everything is fine, then i get the message that the program was unable to create a device.
I have installed the managed framework and directx.
DirectDraw seems to work fine cause i can run the sample project wich is included with: Managed DirectX Tutorial Part 1 - The Title Screen (Managed Metroid)
I'm running Windows XP sp2 rc1 with the latest Managed DirectX SDK (summer 2004) and visual studio.net 2003
|
|
|
|
|
Do you have a 3d capable graphics card? I can run all (well most, some HLSL stuff doesnt work on my hardware ATI8500) the samples here.
top secret xacc-ide 0.0.1
|
|
|
|
|
Of course, else i wouln't try :P
For extra information, my system specs:
Asus A7N8X Deluxe
Amd Athlon XP 2700+
512MB ram
Hercules 3D prophet 9800 pro 128mb(an ati radeon 9800 pro)
So i dont think its a hardware problem.
|
|
|
|
|
NhImF wrote:
Hercules 3D prophet 9800 pro 128mb(an ati radeon 9800 pro)
:drool:
I'm not sure what the problem is then. Sorry.
top secret xacc-ide 0.0.1
|
|
|
|
|
This is a weird problem. I'm not sure you're going to get it figured out here. Maybe you screwed the installation somewhere. Try reinstall. Make sure you have all the necessary part of the SDK installed.
|
|
|
|
|
I have a DataGrid bound to an Access 2K database
entering a time in the grid either via a DatetimePicker or directly into the
field the time displays Ok on the grid but will not update the database
using a DateTimepicker I can see that the value is a string all types in
code and XML schema are dateTime, I have saved the time back to a string
field OK
2 date/time fields formatted dd/mm/yyyy HH:mm in Access - same problem when
formatted at short time and Gener
jnc
|
|
|
|
|
Hi
I have a button named button1 on my form, and this is its evetn handler code:
private void button1_Click(object sender, System.EventArgs e)
{
button1.Location.X += 10;
}
but compiler tells me:
Cannot modify the return value of 'System.Windows.Forms.Control.Location' because it is not a variable
Why can't we change the X and Y properties of a Point object?
|
|
|
|
|
Anonymous wrote:
Why can't we change the X and Y properties of a Point object?
Becuase a Point is a valuetype. You will need to reassign the Location to a modifeid Point object.
top secret xacc-ide 0.0.1
|
|
|
|
|
It doesn't make sense at all! Why should we always make a new instance just to change a single property? It's really ridiculous!
|
|
|
|
|
|
I craete an usercontrol that have this property :
public enum enumShowState{horizantal,vertical} ;<br />
private enumShowState m_showState ;<br />
public enumShowState ShowState<br />
{<br />
get{return m_showState;}<br />
set<br />
{<br />
m_showState=value;<br />
SetShowState(value) ;<br />
}<br />
}
when i use it in my other project, this filtered error will be show :
Projects\mph\frmStudAnswer.cs(111): The variable 'enumShowState' is either undeclared or was never assigned.
and when i click on this error, cursor go to this source code :
public class frmStudAnswer : System.Windows.Forms.Form<br />
{<br />
...<br />
...<br />
private void InitializeComponent()<br />
{<br />
<br />
....<br />
...<br />
this.UserControl1.ShowState = Share.UserControl1.enumShowState.horizantal;<br />
... <br />
...<br />
}<br />
...<br />
}
note that i referenced to my UserControl1 project.
please guide me.
|
|
|
|
|
hd_ali@yahoo.com wrote:
this.UserControl1.ShowState = Share.UserControl1.enumShowState.horizantal;
Try not calling your instances the same names as classes (how about some proper names?). This AFAI concerned a resolution bug in C# compiler, that appears in more than one place.
top secret xacc-ide 0.0.1
|
|
|
|
|
How can I get the address of an object (as IntPtr) or any other variable type ?
Though I could get a variable address in unsafe,
(or maybe there is a better c# way ... I dont know)
unsafe
{
int x=0;
int *p=&x;
}
With objects it's not working, and still I have to convert it from int* to IntPtr ...
Thanks
|
|
|
|
|
|
GCHandle hnd = GCHandle.Alloc(object);
InPtr ptr = hnd.AddrOfPinnedObject();
But seriously what are you going to do with it ?
|
|
|
|
|
If you are trying to read the contents of a specific address without knowing what type of data is held there, then one way of doing it is to call:
Marshal.PtrToStringAnsi(ptr, length)
where 'ptr' represents the address of the first byte and 'length' the number of bytes to be read.
This returns the data in the form of a managed string (with each byte expanded to a 2-byte unicode character), which you can then examine
Naveen
|
|
|
|
|
i need help in dot net relating to mobile computing ..
i need to connect my server from mobile using c# and perform some functions on server from mobile..
where I can get resourses and what i need to study ........ urgent help ..
do best whereever you are...
|
|
|
|
|
Hi,
I put a DataGrid in form and I can browse the fields of a query. Now I want to show some string contents istead of numeric values of a field.
For example I have a field Enabled with (0/1) values and I want to show Enabled/Disabled instead of 0/1 numbers.
How can I do it?
Mehdi
|
|
|
|