TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
fearedpixel
NA
5
0
struct with static array inside
Dec 16 2003 7:03 AM
I am writing a 3d vector class, it has 3 floats in it, x, y and z. I need to provide array access to these values. In C++ I could use union to make a static array reference the same part of memory as the 3 floats. I would like to do something similar in C#, so I dont have to build an array of identical information from the floats every time i need them as an array. The StructLayout attribute with FieldOffset seems like the perfect way to do this, but its no use with arrays since there is only dynamic arrays and not static ones. Can anyone suggest a way I could achieve this? Or is it possible to somehow cast an instance of a struct into an array?
Reply
Answers (
5
)
StreamWriter
Outlook Settings