S
schoenfeld1
Is there a way to cast an object type to a ref struct type?
For example, I need to call the method
public SomeMethod(ref SomeStruct s);
and I need to pass an object o as the parameter. How can I cast o to
(ref SomeStruct s)?
-- here is what I need it for ----
protected override void WndProc(ref Message m) {
if (Asynchronous) {
ManagedThreadPool.QueueUserWorkItem(
new WaitCallback(AsyncWndProc), m);
} else {
AsyncWndProc(m);
}
}
private void AsyncWndProc(object o) {
if (o is Message) { // how do i check if o is a (ref Message)?
base.WndProc(o as Message); // how do cast o to (ref Message)?
}
}
For example, I need to call the method
public SomeMethod(ref SomeStruct s);
and I need to pass an object o as the parameter. How can I cast o to
(ref SomeStruct s)?
-- here is what I need it for ----
protected override void WndProc(ref Message m) {
if (Asynchronous) {
ManagedThreadPool.QueueUserWorkItem(
new WaitCallback(AsyncWndProc), m);
} else {
AsyncWndProc(m);
}
}
private void AsyncWndProc(object o) {
if (o is Message) { // how do i check if o is a (ref Message)?
base.WndProc(o as Message); // how do cast o to (ref Message)?
}
}