473,394 Members | 2,100 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Convert c# form to C++.Net

Has anyone written a utility to convert a C# form to C++.net?
i.e. to convert "using System.Data" to "using namespace System::Data" etc
Nov 17 '05 #1
3 18248
You can compile then decompile your code from C# to C++.NET using Reflector:

http://www.aisto.com/roeder/dotnet/D...File=Reflector

C++ AddIn

http://www.testdriven.net/downloads/...ppLanguage.dll

Steps:

Once downloaded open Reflector
Click the View menu and select the Add-Ins... item.
Click on Add and select the McppLanguage.dll you downloaded.

1. Compile your program either a DLL or EXE
2. Open it with Reflector
3. Select the language you want your source code decompiled in.
4. Right click on the class your want to decompile.

Hope this helps,

Yama Kamyar

"James" wrote:
Has anyone written a utility to convert a C# form to C++.net?
i.e. to convert "using System.Data" to "using namespace System::Data" etc

Nov 17 '05 #2
thanks, but unfortunately Reflector doesn't cover Managed C++.

Thinking about it though, I'm not sure that we really want to write code in
the Managed c++ syntax.
We will probably just write our C# code outside our managed C++ project and
include the assemblies.
(We are using managed C++ in order to write all new dialogs as win forms. We
can't throw all the c++ code away although I wish we could.)
"Yama" wrote:
You can compile then decompile your code from C# to C++.NET using Reflector:

http://www.aisto.com/roeder/dotnet/D...File=Reflector

C++ AddIn

http://www.testdriven.net/downloads/...ppLanguage.dll

Steps:

Once downloaded open Reflector
Click the View menu and select the Add-Ins... item.
Click on Add and select the McppLanguage.dll you downloaded.

1. Compile your program either a DLL or EXE
2. Open it with Reflector
3. Select the language you want your source code decompiled in.
4. Right click on the class your want to decompile.

Hope this helps,

Yama Kamyar

"James" wrote:
Has anyone written a utility to convert a C# form to C++.net?
i.e. to convert "using System.Data" to "using namespace System::Data" etc

Nov 17 '05 #3
What do you mean? It works fine for me.... If I have code written in C# I can
decompile it in managed C++ but in order for that to work I need to reference
the McppLanguage DLL.

A little test:
The Iterator design pattern written in C#:

namespace Iterator
{
internal abstract class AbstractCollection
{
// Methods
protected AbstractCollection();
public abstract Iterator.Iterator CreateIterator();
}

internal abstract class AbstractIterator
{
// Methods
protected AbstractIterator();
public abstract Item CurrentItem();
public abstract Item First();
public abstract bool IsDone();
public abstract Item Next();
}

internal class Collection : AbstractCollection
{
// Methods
public Collection();
public override Iterator.Iterator CreateIterator();

// Properties
public int Count { get; }
public object this[int index] { get; set; }

// Fields
private ArrayList items;
}

public class Form1 : Form
{
// Methods
public Form1();
protected override void Dispose(bool disposing);
private void Form1_Load(object sender, EventArgs e);
private void InitializeComponent();
[STAThread]
private static void Main();

// Fields
private Container components;
private TextBox txtIteratorText;
}

internal class Item
{
// Methods
public Item(string name);

// Properties
public string Name { get; }

// Fields
private string name;
}

internal class Iterator : AbstractIterator
{
// Methods
public Iterator(Collection collection);
public override Item CurrentItem();
public override Item First();
public override bool IsDone();
public override Item Next();

// Properties
public int Step { get; set; }

// Fields
private Collection collection;
private int current;
private int step;
}
}
Compiled then decompiled to C++ using Reflector:
namespace Iterator
{
private __gc abstract class AbstractCollection
{
// Methods
protected: AbstractCollection();
public: abstract Iterator::Iterator __gc * CreateIterator();
};

private __gc abstract class AbstractIterator
{
// Methods
protected: AbstractIterator();
public: abstract Iterator::Item __gc * CurrentItem();
public: abstract Iterator::Item __gc * First();
public: abstract System::Boolean IsDone();
public: abstract Iterator::Item __gc * Next();
};

[System::Reflection::DefaultMember(S"Item")]
private __gc class Collection : public Iterator::AbstractCollection
{
// Methods
public: Collection();
public: override Iterator::Iterator __gc * CreateIterator();

// Properties
public: __property System::Int32 get_Count();
public: __property System::Object __gc * get_Item(System::Int32
index);public: __property void set_Item(System::Int32 index, System::Object
__gc * value);

// Fields
private: System::Collections::ArrayList __gc * items;
};

public __gc class Form1 : public System::Windows::Forms::Form
{
// Methods
public: Form1();
protected: override void Dispose(System::Boolean disposing);
private: void Form1_Load(System::Object __gc * sender,
System::EventArgs __gc * e);
private: void InitializeComponent();
[System::STAThread]
private: static void Main();

// Fields
private: System::ComponentModel::Container __gc * components;
private: System::Windows::Forms::TextBox __gc * txtIteratorText;
};

private __gc class Item
{
// Methods
public: Item(System::String __gc * name);

// Properties
public: __property System::String __gc * get_Name();

// Fields
private: System::String __gc * name;
};

private __gc class Iterator : public Iterator::AbstractIterator
{
// Methods
public: Iterator(Iterator::Collection __gc * collection);
public: override Iterator::Item __gc * CurrentItem();
public: override Iterator::Item __gc * First();
public: override System::Boolean IsDone();
public: override Iterator::Item __gc * Next();

// Properties
public: __property System::Int32 get_Step();public: __property
void set_Step(System::Int32 value);

// Fields
private: Iterator::Collection __gc * collection;
private: System::Int32 current;
private: System::Int32 step;
};
}
Any questions?

Yama
"James" wrote:
thanks, but unfortunately Reflector doesn't cover Managed C++.

Thinking about it though, I'm not sure that we really want to write code in
the Managed c++ syntax.
We will probably just write our C# code outside our managed C++ project and
include the assemblies.
(We are using managed C++ in order to write all new dialogs as win forms. We
can't throw all the c++ code away although I wish we could.)
"Yama" wrote:
You can compile then decompile your code from C# to C++.NET using Reflector:

http://www.aisto.com/roeder/dotnet/D...File=Reflector

C++ AddIn

http://www.testdriven.net/downloads/...ppLanguage.dll

Steps:

Once downloaded open Reflector
Click the View menu and select the Add-Ins... item.
Click on Add and select the McppLanguage.dll you downloaded.

1. Compile your program either a DLL or EXE
2. Open it with Reflector
3. Select the language you want your source code decompiled in.
4. Right click on the class your want to decompile.

Hope this helps,

Yama Kamyar

"James" wrote:
Has anyone written a utility to convert a C# form to C++.net?
i.e. to convert "using System.Data" to "using namespace System::Data" etc

Nov 17 '05 #4

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

Similar topics

5
by: Andrew V. Romero | last post by:
At work we have an excel file that contains the list of medications and their corresponding strengths. I would like to save the excel file as a text list and paste this list into a javascript...
4
by: Richard Hollenbeck | last post by:
I'm trying to write some code that will convert any of the most popular standard date formats twice in to something like "dd Mmm yyyy" (i.e. 08 Jan 1908) and compare the first with the second and...
19
by: jeff | last post by:
how do you convert form byte to Int32 while retaining the binary value of the byte array
1
by: Daniel | last post by:
I have looked everywhere on the web for an answer to this and the only thing I can find is converting the image format when the file is present on the local filesystem. What I want to do is use a...
3
by: Thubaiti | last post by:
Hi, I have this code in my ASP.NET and I want to convert it to C# (code behind) <asp:Repeater id="subCategoryRepeater" runat="server"> <ItemTemplate> <ul> <li> <asp:HyperLink...
2
by: egoldthwait | last post by:
I need to convert a 17mb access 2000 db to Oracle and house it in a Citrix farm. The issue: we have never converted an Access Db to Oracle but can probably use Oracle's Workbench to assist with...
14
by: Me | last post by:
Hi all I am getting a really bizzare error on when I convert a string into a datetime: The code is : DateTime dt1 = Convert.ToDateTime("10 Sep 2005"); Console.WriteLine(dt1.Year);
4
by: faizal87 | last post by:
hallo...can i get some knowladge...about java script convert to V.B....how??like 'calculation downloadable',i've get a formula calculate but in java script....how i want convert this language to V.B...
1
by: rdraider | last post by:
I can't seem to find a way to convert an INT type in the form of YYYYMMDD to an actual date form of mm/dd/yyyy Can anyone pointt me in the right direction? Thanks
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.