|
James T. Johnson wrote:
Otherwise there isn't an advantage that I can think of.
Some languages are more comfortable. When you do MC++, you don't feel as alienated from real unmanaged life as when you do C#
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Buy it, read it and admire me
|
|
|
|
|
Nish - Native CPian wrote:
When you do MC++, you don't feel as alienated from real unmanaged life as when you do C#
I don't feel alienated from it because I have P/Invoke and if I really need to, I know I can just create an assembly in MC++ and do my work there.
James
|
|
|
|
|
James T. Johnson wrote:
I have P/Invoke
James T. Johnson wrote:
create an assembly in MC++
Why go to all that bother just to do C#? What's so appealing about it?
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Buy it, read it and admire me
|
|
|
|
|
For .NET code its a lot cleaner to me. You need to be aware of a few performance tweaks (such as avoiding unnecessary boxing) but over all the syntax is much better.
Which of these do you prefer?
MC++
ptr = *dynamic_cast<__box System::IntPtr*>(arlist->Item[index]); or this
C#
ptr = (IntPtr) arlist[index] However, the code I sent you the other day would convince me to switch to MC++ in a heart beat
James
|
|
|
|
|
James T. Johnson wrote:
However, the code I sent you the other day would convince me to switch to MC++ in a heart beat
Yeah. That was cool
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Buy it, read it and admire me
|
|
|
|
|
Michael P Butler wrote:
What advantages do we get for doing UI code in MC++ compared to doing it in C# ?
None except personal preference. Basically anything you do in C# can be one-to-one mapped in VB .NET
But still lot of people don't do VB .NET.
Similarly some only do VB .NET.
And I prefer MC++.
And I can tell you that it's a cool feeling when you can use an MFC CString alongside a .NET String in the same source file. You cannot do that with C# or VB .NET, can you?
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Buy it, read it and admire me
|
|
|
|
|
Nish - Native CPian wrote:
And I can tell you that it's a cool feeling when you can use an MFC CString alongside a .NET String in the same source file. You cannot do that with C# or VB .NET, can you?
Actually, isn't that an ATL string [in] MFC [in] .NET
Rocky Moore
|
|
|
|
|
|
Hi!
I'm writing a cross-platform app using the .NET framework. The bulk of my program is in C# but for performance reasons, I'm had to implement a bit in Managed C++.
My Managed C++ .dll includes a class that implements the IList interface:
...
__property virtual bool get_IsReadOnly();
__property virtual Object* get_Item(int index);
__property virtual void set_Item(int index, Object* value);
virtual int Add(Object* value);
etc.
So, the get_Item/set_Item properties above appear as the Item property in VB.NET and MC++. In C#, it should appear as an indexer (object this[int index]). However, what I get is two methods called get_Item and set_Item.
What's wrong?
|
|
|
|
|
This problem has been reported a few days ago in this same forum by someone else. Apparently MC++ collections are not accessible through C# indexers.
I haven't tried it out yet.
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Buy it, read it and admire me
|
|
|
|
|
Its not just MC++ collections that can't be accessible through C# indexers; its that MC++ indexers don't come up in C# as indexers.
I can't figure out why that is; because I haven't looked into it much; maybe I'll revisit that issue now
James
|
|
|
|
|
James T. Johnson wrote:
Its not just MC++ collections that can't be accessible through C# indexers; its that MC++ indexers don't come up in C# as indexers.
I can't figure out why that is; because I haven't looked into it much; maybe I'll revisit that issue now
Puzzling!!!
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Buy it, read it and admire me
|
|
|
|
|
It takes the debugger about 10 seconds to start up when debugging mixed managed and unmanaged C++ code. If I set the debugger to "managed only", the application is launched in less than one second. I noticed that the network is very busy during the launching of the debugger when in mixed mode - is there something I can change to get mixed mode debugging to startup faster? Thanks
Chris Hafey
|
|
|
|
|
I have had the same problem. When mixing managed and unmanaged code the debugger is super slow. Sometimes I get so fed up I use Ctrl-F5 and run it non-debugged
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Buy it, read it and admire me
|
|
|
|
|
I hear you. I am soooo sick of this. I need to find a computer running dual processors!!!
|
|
|
|
|
|
I'm writting an app in MC++. One of its class is a collection and I don't know what to do to have indexers in C#.
When I disassemble C# code the indexer function is as follow:
get_Item : class System.String(int32)
I tried to add function like this but I didn't work.
Can somebody tell if it's possible.
|
|
|
|
|
Create a property called Item which takes a common parameter in both its set/get functions. ie
__property System::String* get_Item(int index)
{
....
}
__property void set_Item(int index, System::String* value)
{
....
} I don't see anything that lets you create a C# indexer were the class instance can be treated as an array; I assume if you use the Item property name it allows C# to use it as if it were one.
HTH,
James
|
|
|
|
|
I don't work.
C++ function disassembly is
.method public specialname instance string
get_Item(int32 index) cil managed
and C# is
.method public hidebysig specialname instance string
get_Item(int32 index) cil managed
Mayby it's possible to write this function in CLR?
|
|
|
|
|
It appears Indexers created in MC++ only work in MC++ AND you can't create an indexer that operates on a class instance.
I'll look into it more after the hockey game
James
|
|
|
|
|
I'll appreciate it.
Thanks
|
|
|
|
|
I want to serialize using xml a class which contains a IPEndPoint field. I can't get it to work. Does anybody know what to do? But I don't want to use other formatter. Help!!! Please.
public class __gc Message
{
public:
__property Byte get_ByteMessage ( )[] { return m_byteMessage; }
__property void set_ByteMessage ( Byte byteMessage[] ) { m_byteMessage = byteMessage; }
__property IPEndPoint* get_Sender ( ) { return m_ipeEndPoint; }
private:
Byte m_byteMessage[];
IPEndPoint* m_ipeEndPoint;
}
|
|
|
|
|
Is IPEndPoint a serializable class? If not it won;t get serialized. Not automatically. Not sure of this, but if you can derive another class from IPEndPoint, and then add the serialization stuff, it just might work. Not very sure about it though, as I already said
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Buy it, read it and admire me
|
|
|
|
|
IPEndPoint is a serializable class. In addition, I can't even serialize IPEndPoint itself using xml of course.
m_xmlsSerializer = new XmlSerializer( __typeof ( IPEndPoint) );
Any other ideas?
|
|
|
|
|
Michael Mac wrote:
I can't even serialize IPEndPoint itself using xml of course.
Does it have a public constructor? The exception normally gives the detail reason of what is missing from the class
|
|
|
|