Hi I have a struct in my form, and I need to pass a reference/handle to it to a separate class, which is ok with the simple "ref" keyword. Now, how do I store this ref to a struct in the class (as a member variable)? Is this possible? I hope so...

Recommended Answers

All 4 Replies

simple, just create a variable with the struct inside class...
struct MYStruct
{

}

class MyClass
{
MYStruct instanceMyStruct; // create a property if you want to..
}

Is it possible with this "boxing" thing I've heard of? Like making it an "object" instance and using that?

i suppose it shud work, because MYStruct is a type of object, so boxing should work.
can u try that out..?

i suppose it shud work, because MYStruct is a type of object, so boxing should work.
can u try that out..?

I haven't been using C# much and it isn't my first language, I don't know how to do it so I was hoping you could show me in a line or two, but ok.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.