C# Unmanaged Object scope

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello, Why is obj invalid in method2 even after calling method1 ?

class A
{
obj ;

method1(param)
{
obj = unmanaged_call()
}
method2()
{
obj // obj is no more valid / invalid here ??
}
 
Hello, Why is obj invalid in method2 even after calling method1 ?

Please post some real code that actually compiles. It's hard to say
anything based on your pseudo code.

And in what way is the object invalid?



Mattias
 
c#,

Is it possible that the call to unmanaged_call throws an exception, and
leaves obj in a null/invalid state? That's the only reason I can think of.

Hope this helps.
 
Back
Top