Something like :-
namespace MyNamespace
{
public __gc class MyObject : public MarshalByRefObject
{
public:
Object* InitializeLifetimeService()
{
// This lease never expires.
return 0;
// Use following code to define the exact lease time.
ILease* lease = static_cast<ILease*>(
MarshalByRefObject::InitializeLifetimeService());
if (lease->CurrentState == LeaseState::Initial)
{
lease->InitialLeaseTime = TimeSpan::FromSeconds(5);
lease->SponsorshipTimeout = TimeSpan::FromSeconds(0);
lease->RenewOnCallTime = TimeSpan::FromSeconds(5);
}
return lease;
}
};
}
BTW, since you return at the beginning of the function the rest of the code
never gets executed.
--
Regards,
Nish [VC++ MVP]
"José Achig" <jo*******@hotmail.com> wrote in message
news:OJ**************@TK2MSFTNGP12.phx.gbl...
Hello
I want to change this code example wrote in C# to VC++ .NET, please give
me a translation
namespace MyNamespace
{
public class MyObject : MarshalByRefObject{
public override Object InitializeLifetimeService()
{
// This lease never expires.
return null;
// Use following code to define the exact lease time.
ILease lease = (ILease)base.InitializeLifetimeService();
if (lease.CurrentState == LeaseState.Initial)
{
lease.InitialLeaseTime =
TimeSpan.FromSeconds(5);
lease.SponsorshipTimeout =
TimeSpan.FromSeconds(0);
lease.RenewOnCallTime =
TimeSpan.FromSeconds(5); }
return lease;
}
}
}
Thanks in advance!!!