help converting c# to c++?

G

Guest

Is there any way to convert this code to c++ from c#?

System.Web.HttpContext.Current.Session["CookieContainer"] =
outputChannel.Options.CookieContainer;

Thanks in advance.
Regards Joel
 
K

Kevin Spencer

In C#, that would be:

System.Web.HttpContext.Current.Session["CookieContainer"] =
outputChannel.Options.CookieContainer;

--
HTH,

Kevin Spencer
Microsoft MVP
Chicken Salad Surgery

Orange you bland I stopped splaying bananas?
 
G

Guest

well thanks but i meant a conversion the other way... :)
c# to c++

Regards Joel.

Kevin Spencer said:
In C#, that would be:

System.Web.HttpContext.Current.Session["CookieContainer"] =
outputChannel.Options.CookieContainer;

--
HTH,

Kevin Spencer
Microsoft MVP
Chicken Salad Surgery

Orange you bland I stopped splaying bananas?


Joel said:
Is there any way to convert this code to c++ from c#?

System.Web.HttpContext.Current.Session["CookieContainer"] =
outputChannel.Options.CookieContainer;

Thanks in advance.
Regards Joel
 
C

Carl Daniel [VC++ MVP]

Joel said:
Is there any way to convert this code to c++ from c#?

System.Web.HttpContext.Current.Session["CookieContainer"] =
outputChannel.Options.CookieContainer;

Assuming you're talking about C++/CLI (VC++ 2005 only), then it'd be
something like:

System::Web::HttpContext::Current->Session["CookieContainer"] =
outputChannel->Options->CookieContainer;

If you're talking about ISO standard C++, then it'd be something completely
different, since none of those classes is accessible from standard (native,
unmanaged) C++.

-cd
 
K

Kevin Spencer

I must be dyslexic this morning!

I do seem to remember laying awake all night wondering if there really is a
dog...

--

Kevin Spencer
Microsoft MVP
Chicken Salad Surgery

Orange you bland I stopped splaying bananas?


Joel said:
well thanks but i meant a conversion the other way... :)
c# to c++

Regards Joel.

Kevin Spencer said:
In C#, that would be:

System.Web.HttpContext.Current.Session["CookieContainer"] =
outputChannel.Options.CookieContainer;

--
HTH,

Kevin Spencer
Microsoft MVP
Chicken Salad Surgery

Orange you bland I stopped splaying bananas?


Joel said:
Is there any way to convert this code to c++ from c#?

System.Web.HttpContext.Current.Session["CookieContainer"] =
outputChannel.Options.CookieContainer;

Thanks in advance.
Regards Joel
 
G

Guest

No actually I was talking about vc++ 2003.
Sorry for not making that clear.

Its not working with the ["CookieContainer"] part.

I have now solved my issue i another way but im still curious if and how its
possible to translate that part?

Regards
Joel

Carl Daniel said:
Joel said:
Is there any way to convert this code to c++ from c#?

System.Web.HttpContext.Current.Session["CookieContainer"] =
outputChannel.Options.CookieContainer;

Assuming you're talking about C++/CLI (VC++ 2005 only), then it'd be
something like:

System::Web::HttpContext::Current->Session["CookieContainer"] =
outputChannel->Options->CookieContainer;

If you're talking about ISO standard C++, then it'd be something completely
different, since none of those classes is accessible from standard (native,
unmanaged) C++.

-cd
 
C

Carl Daniel [VC++ MVP]

Joel said:
No actually I was talking about vc++ 2003.
Sorry for not making that clear.

Its not working with the ["CookieContainer"] part.

I have now solved my issue i another way but im still curious if and how
its
possible to translate that part?

I think you have to call the indexer by name using function call syntax
instead of the indexer syntax. The name of the indexer should be get_Item,
so it'd be:

System::Web::HttpContext::Current->Session->get_Item("CookieContainer") =
outputChannel->Options->CookieContainer;

-cd
 
P

Peter Bromley

Carl said:
No actually I was talking about vc++ 2003.
Sorry for not making that clear.

Its not working with the ["CookieContainer"] part.

I have now solved my issue i another way but im still curious if and how
its
possible to translate that part?


I think you have to call the indexer by name using function call syntax
instead of the indexer syntax. The name of the indexer should be get_Item,
so it'd be:

System::Web::HttpContext::Current->Session->get_Item("CookieContainer") =
outputChannel->Options->CookieContainer;

HttpContext.Current.Session["CookieContainer"]

is actually C# shorthand for

HttpContext.Current.Session.Item["CookieContainer"]

So... in C++

HttpContext::Current->Session->Item["CookieContainer"]


C# treats Item[xxx] as a special case and allows you to drop the
property name "Item".

Cheers,

Peter
 
G

Guest

The following two will work in C++/CLI:

HttpContext::Current->Session["CookieContainer"]

HttpContext::Current->Session->default["CookieContainer"]

--
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C#/VB to C++ converter
C# Code Metrics: Quick metrics for C#


Carl Daniel said:
Joel said:
No actually I was talking about vc++ 2003.
Sorry for not making that clear.

Its not working with the ["CookieContainer"] part.

I have now solved my issue i another way but im still curious if and how
its
possible to translate that part?

I think you have to call the indexer by name using function call syntax
instead of the indexer syntax. The name of the indexer should be get_Item,
so it'd be:

System::Web::HttpContext::Current->Session->get_Item("CookieContainer") =
outputChannel->Options->CookieContainer;

-cd
 
C

Carl Daniel [VC++ MVP]

Peter Bromley said:
Carl said:
No actually I was talking about vc++ 2003.
Sorry for not making that clear.

Its not working with the ["CookieContainer"] part.

I have now solved my issue i another way but im still curious if and how
its
possible to translate that part?


I think you have to call the indexer by name using function call syntax
instead of the indexer syntax. The name of the indexer should be
get_Item, so it'd be:

System::Web::HttpContext::Current->Session->get_Item("CookieContainer") =
outputChannel->Options->CookieContainer;

So... in C++

HttpContext::Current->Session->Item["CookieContainer"]

....which is just shorthand for

HttpContext::Current->Session->get_Item("CookieContainer")

Both work in Managed C++ (old syntax), while

HttpContext::Current->Session->default["CookieContainer"]

and

HttpContext::Current->Session["CookieContainer"]

both work in C++/CLI (new syntax).

-cd
 
G

Guest

Thank you all for that important piece of knowledge.

It will help me in my future development.

Regards
Joel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top