473,385 Members | 1,355 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to make a new struct given System.Type

Hi,

Im using reflection and I need to make a new object of type Sytem.Type

ive used ConstructorInfo to make the other
types such as classes ok, and I can handle the primitive types
by testing for Int32 etc, but I dont know what the possible struct will
be before hand, the ConstructorInfo fails to find one for any struct.

is there a way ? ... thers got to be a way ...

for the case where I read a a struct binarily from a file
I can use PtrToStructure,
however I now have an awkward structure wich has an object reference.

it falls over if I try it with this.
but I cant find out how to make a new struct so I can read the fields
individualy

also I have imported structures from other language,
(unreal script) these have base structs wich obvoulsy dont exist in c#
so I have to handle them somehow.

but is there a general way of storing base classes,
do they come first as layed out in memory ?

as I have to read in a struct wich has a base class.

~~~~~~

also on a diferent note in the object browser
it would be nice to know all types of System.Exception for example
is there a way to find what types have that as a base class?
or even what functions return a particular type ?

ive looked a bit but cant find any helpfull search terms.

Colin =^.^=
Nov 8 '07 #1
0 990

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

60
by: Mohd Hanafiah Abdullah | last post by:
Is the following code conformat to ANSI C? typedef struct { int a; int b; } doomdata; int main(void) { int x;
6
by: S.Tobias | last post by:
I'm trying to understand how structure type completion works. # A structure or union type of unknown # content (as described in 6.7.2.3) is an incomplete type. It # is ...
21
by: hermes_917 | last post by:
I want to use memcpy to copy the contents of one struct to another which is a superset of the original struct (the second struct has extra members at the end). I wrote a small program to test...
1
by: Tom | last post by:
Couple of questions relating to boxing. Firstly, I already know that boxing is the processing of temporarily copying a ValueType (e.g. struct, enum) to the heap so that the system can treat a...
6
by: Mel | last post by:
I am translating C++ to C# coding. I have given array of struct in C++, is there any good alternatives for "array of struct" in c#? I hope anyone can help. Thank you very much.
5
by: Martin Jørgensen | last post by:
Hi, Consider this code: --- beginning of code --- #include <iostream> using namespace std; class Child{ public:
11
by: juyi520 | last post by:
Hello, I am new in C in Programming, Where could I find the detail about struct FILE in RedHat Linux ? I have tried to check the stdio.h in /usr/include, but I could not find the
14
by: Lane Straatman | last post by:
I would like to write a 'struct'. I have a library that is all but completely inappropriate for this task. So I'm looking for C code that fills in the gaps between: #undef...
6
by: Raj Wall | last post by:
Hi, I am trying to implement the IEqualityComparer interface for a struct so I can use it as the Key for a Dictionary. My struct declaration has: public struct Ring : IEqualityComparer {...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.