473,569 Members | 2,601 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting Type of Array Members

I'm iterating through various members of a struct using Reflection. While I
can use fieldInfo.Field Type.BaseType to determine that a member is an array,
how do I determine what that array is an array of.

e,g., I want it to tell me that a UInt32[] member is an Array of UInt32 (via
code).

Thank you,
Laszlo
Nov 15 '05 #1
4 1799
Type.GetTypeArr ay?

If you already know the array is homogeneous, can you not do a
array[0].GetType() ?

vJ

"Laszlo Szijarto" <ls*******@nosp am.mrdoc.cc> wrote in message
news:bq******** **@sulawesi-fi.lerc.nasa.go v...
I'm iterating through various members of a struct using Reflection. While I can use fieldInfo.Field Type.BaseType to determine that a member is an array, how do I determine what that array is an array of.

e,g., I want it to tell me that a UInt32[] member is an Array of UInt32 (via code).

Thank you,
Laszlo

Nov 15 '05 #2
Laszlo,

If you have the Type of the array, you can call the GetElementType
method on the Type to get the Type of the elements contained in the array.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Laszlo Szijarto" <ls*******@nosp am.mrdoc.cc> wrote in message
news:bq******** **@sulawesi-fi.lerc.nasa.go v...
I'm iterating through various members of a struct using Reflection. While I can use fieldInfo.Field Type.BaseType to determine that a member is an array, how do I determine what that array is an array of.

e,g., I want it to tell me that a UInt32[] member is an Array of UInt32 (via code).

Thank you,
Laszlo

Nov 15 '05 #3
i.e., how do I get the Type of the Array Elements

"Laszlo Szijarto" <ls*******@nosp am.mrdoc.cc> wrote in message
news:bq******** **@sulawesi-fi.lerc.nasa.go v...
I'm iterating through various members of a struct using Reflection. While I can use fieldInfo.Field Type.BaseType to determine that a member is an array, how do I determine what that array is an array of.

e,g., I want it to tell me that a UInt32[] member is an Array of UInt32 (via code).

Thank you,
Laszlo

Nov 15 '05 #4
that's the stuff --

thanks, Nicholas,

Laszlo
Nov 15 '05 #5

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

Similar topics

47
5045
by: VK | last post by:
Or why I just did myArray = "Computers" but myArray.length is showing 0. What a hey? There is a new trend to treat arrays and hashes as they were some variations of the same thing. But they are not at all. If you are doing *array", then you have to use only integer values for array index, as it was since ALGOL.
6
4184
by: Eric Smith | last post by:
Is a structure containing an incomplete array as its last element (per paragraph 2 of section 6.7.2.1 of ISO/IEC 9899:1999 (E)) itself an incomplete type? That appears to be indicated by paragraph 22 of section 6.2.5. If so, that seems to make it difficult to allocate such structures, because sizeof() is not allowed on incomplete types...
15
2748
by: damian birchler | last post by:
Hi I'm wondering of what type a structure is. Of course, it is a _structure_, but an array isn't an _array_ either. So of what type is a structure? I'd say a pointer, am I right?
6
4781
by: Ken Varn | last post by:
I have an ASP.NET application that is calling a custom class that is trying to parse all of the members of my Page object using Type.GetMembers(). The problem that I am having is that private members are not returned. I did some digging and the MSDN documentation states that the caller must have ReflectionPermission in order to get the...
5
4681
by: J | last post by:
I have a string with lots of numbers i need in a seperate an array. each number is split using a ",". How do i split them up and put them in to an array. eg. egstring = 1,23,423,2,2 i need to get the numbers 1 23
6
4407
by: =?Utf-8?B?dGhsMTAwMA==?= | last post by:
Hi NG, i need to list the logonHours for a specific user. I'm trying to convert code from vbscript (is working) to vb.net, but the vb.net code does not work. Here are the code listings: 1: vbscript:
12
2549
by: Premal | last post by:
Hi, I tried to make delete operator private for my class. Strangely it is giving me error if I compile that code in VC++.NET. But it compiles successfully on VC++6.o. Can anybody give me inputs about it. I wanted that on my class delete should not work. Object pointer should be deleted using my function only which is taking care of...
7
2816
by: =?Utf-8?B?Sm9lbCBNZXJr?= | last post by:
I have created a custom class with both value type members and reference type members. I then have another custom class which inherits from a generic list of my first class. This custom listneeds to support cloning: Public Class RefClass Public tcp As TcpClient Public name As String End Class Public Class RefClassList Inherits List(Of...
8
242
by: Richard Heathfield | last post by:
candide said: I don't think it says so in exactly those words (and if it does, I'd argue that it's wrong). Certainly I can't find such wording on a cursory look through that section. Okay, here's the whole thing. There exists an array of char *. Zero (or more, but exactly argc) members
0
7701
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8130
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7677
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6284
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3643
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2115
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1223
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.