473,516 Members | 2,711 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

translation from C# to VC++ .NET

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!!!

Nov 16 '05 #1
2 2625
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!!!


Nov 16 '05 #2
Thank you for your response.

I'm very glad,

I hope you have a nice day!!!

Jose
Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2788
by: Matt | last post by:
Short Description: The Translation Hub is not picking up the TNS names file. I'm using Oracle 9ids. It doesn't work for any users and it has never worked since it's been installed. Long Description: The translation hub will work if the following entry is modified in the registry:
40
2948
by: Chiwa | last post by:
Hey, Expression: Math.floor(x * 100) / 100 x= 4.1 gives 4.09, why in gods name? While other values for x don't give a problem. Thx in advance
5
5431
by: Haines Brown | last post by:
I suspect this is a FAQ, but as a guide to my further investigation, I wondered what the options are for providing readers of my web pages with the ability to translate the pages into their own language. Haines Brown
7
5077
by: Steven T. Hatton | last post by:
Is there anything that gives a good description of how source code is converted into a translation unit, then object code, and then linked. I'm particularly interested in understanding why putting normal functions in header files results in multiple definition errors even when include guards are used. -- STH Hatton's Law: "There is only...
7
2226
by: Peter Eisentraut | last post by:
Greetings. The official PostgreSQL documentation has been translated to German and has been published as a book by verlag moderne industrie/mitp ("PostgreSQL: Das offizielle Handbuch", ISBN 3-8266-1337-6, see <http://www.mitp.de/vmi/mitp/detail/pWert/1337>). I am the translator of this work, but let me assure you I don't get any additional...
4
9848
by: Chris Croughton | last post by:
Does a translation unit have to have at least one externally visible declaration or function definition to be valid? As I read the standard, it doesn't: it must have at least one declaration or function definition, but they can be static, extern or even a typedef. 6.9 External definitions 1 translation-unit: external-declaration...
1
1180
by: Jerry Shea | last post by:
Does anyone know of a tool which can accomplish this? I suppose I could port my C program to managed VC++ then decompile. Anyone know of any other mechanisms?
2
1912
by: James | last post by:
In oracle I can do the following: select CONVERT(COLUMNOFNAMES,'US7ASCII') from mytable -- It will take a name like Albrecht Dürer and change it into Albrecht Durer and is useful in where clauses where you do not know if a user is going to enter u or ü -- I convert the user input into Durer as well as the column and query against it and...
0
1162
by: Stef Mientki | last post by:
hello, I've build a translation tool, to translate all strings in a python source file. As a extra gadget I added translation through Babel Fish, using beautifulsoup. Although it works functionally, it can take lots of time waiting for the translation.
0
7182
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7581
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7142
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5714
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5110
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3267
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3259
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1624
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
825
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.