First of all, why do you want to use IntPtr
and Marshal.PtrToStructure
? Is there a specific need for this? If there is a specific need, come with that problem.
Or you're just trying to change the argument you passed to a function?
If you just want to change the parameter, I suggest, you have a look at out
(also see this link) and ref
keywords, and how to use them, links' got the examples too, just read them thoroughly.
In C#, how is a struct/class diffrent, what is a c# struct in c++? Does creating a class with new in c# always result in being Class* ?
I don't know why, but I'm getting a feel that you're not much familiar with Reference Types and Value Types, so let me explain them to you first, then you can better understand the difference between class/struct, so I'm not straightforwardly answering your question, hold on, till you find your answer in there.
There are two main types in C#, first is Refernce Types and second is Value Types
C# Common Type System (CTS) has a simple hierarchy, following diagram illustrates the relationship between Value Types and Reference Types in CTS.

Reference Types
Whenever you create a Reference Type, it only creates the Reference (C++ also have references, but C# References are somewhat different from C++ References, see this -> C++ references Vs C# references) on the stack, and the object (if created) is created on heap (C# References are pretty close to the C++ Pointers).
C# Reference Types include:
I've provided the links to all of them, you can go ahead and read them all.
Value Types
Whenever you create an object of a Value Type, itself it is created on the stack, and not the heap (only Reference Types are created at heap)
MSDN Documentation of Value Types state:
Variables that are based on value types directly contain values. Assigning one value type variable to another copies the contained value. This differs from the assignment of reference type variables, which copies a reference to the object but not the object itself.
Value Types includes:
Structs fall into these categories:
Numeric Types
- bool
- and User defined Structures
I've just provided you the content, you'd have to read it yourself.
So the answer to your question:
how is struct/class different, what is c# struct in c++?
is that struct is a value type, and class is reference type, so creating an instance of a class will create just a reference (or say pointer, don't use this term, because they're not pointers, but just to have some understanding) in stack and will create the instance itself in Managed Heap (to have some understanding of Managed Heap, study the Automatic Memory Management in C#). And when creating an instance of a struct, it will create the object in stack and not the Managed Heap.
Does creating a class with new in c# always result in being Class* ?
No and Yes!
No in the sense that classes fall in the category of Reference types, and a reference is created on the stack and not the pointer, so you can't say that a pointer to class instance is being created but reference is.
Yes is in the sense, when you say (informally) that the references in C#, they're much like pointers.
EDIT
I see, you're trying to consume your void GetData(Entity& entity, Filter* filter, Data* data)
function (or similar functions) in your C# code, see Passing Structures and Classes, I think you can find your answer there.