Will a .cs file work in a .java software? [closed] - c#

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
So I'm thinking about making a GUI. My friend told me he knew how to do it in C#, so I went that method in setting the GUI up. Is there anyway to get a C# made GUI usable in java?

Yes you can. You absolutely should not.
I once wrote a perl application that used a VB GUI that i made, they communicated via OLE.
This is probably the worst construct you could ever do so don't :)

Not practically. You can't just give the C# compiler a Java file, or vice versa.
If you're really determined though, you can use IKVM to expose Windows Forms to Java.
There's also J# but it's not being actively developed anymore.

I think you should learn how to make a GUI in Java if you are coding in Java. However if you want both of C# and Java to interoperate, then you need a new layer which acts like a bridge between a C# program runs on CLR and Java program runs on JVM. The following link has a good explanation about how to call Java routines directly from a C# program over runtime bridges:
http://www.devx.com/interop/Article/19945/1954
You need to bind something on GUI with an appropriate logic. Such as File>New menu selection might exist for creating a new file. Therefore this menu command needs to be bound to a logic. You can not run away without writing these logic, the event handlers or without defining some other functionalities inside of GUI classes. Strictly speaking, you always need to write a lot of code on presentation layer which consists of GUI classes. So that, your friend does also need to build up the presentation layer itself. Because a useless user interface is called a prototype not a program. And also do not forget about that runtime bridges significantly decrease the performance. Eventually, I suggest you to go and learn how to make GUI in Java.

No! It would not work. Java's GUI classes are different, so even if you renamed your .cs files to .java files and made slight modifications, the code would not work.

No. It won't work. You can't compile Java and C# into a single executable package.

No. The way Java and .NET interact with the GUI is totally different.

Related

Running native Delphi code in dot net environment with c sharp [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I have a Delphi program consisting of mostly Visual Interface(Buttons, TextBoxes etc.) and a little bit business logic.
The business logic is mostly included in Pl-Sql of Oracle Database running by Delphi.
I want to carry the project in Delphi to C Sharp but i want to do this part by part.
What i think is to create a C Sharp project in Visual Studio and to run it with Delphi code(including Visual Interfaces) and part by part replace the code and the Visual Interface in Delphi with C Sharp.
Is it possible?
Mixing Delphi and C# GUI in the same application is possible, but hard to achieve. You'll need to set up a whole infrastructure to organise interop between the two languages. You'll end up creating a huge amount of interop code that you will subsequently abandon. Even worse, the interop code will need to be two way. You'll sometimes have C# visual code talking to Delphi non-visual. And vice-versa. The idea of converting the code module by module sounds good, but I predict it will entail vast amounts of interop scaffolding.
It would be easier to slice it along the visual/non-visual divide, but that's not what you are proposing. So frankly I think your current plan is far from optimal. I would not entertain it. I think a clean port is the best option.
Remobjects Hydra seems to be exactly what you are looking for.

Mini BASIC IDE from C# [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
How could I approach this and are there any libraries out there to simplify it?
Users need to be able to write “Macros” in a VB like language which is stored in a plain text file.
These Macros are then attached to a given button in a C# App and executed when the button is clicked.
This is to be a windows forms app (could be WPF) using .net 4
I need to support popping up forms with controls on them such as text boxes, dropdown lists, labels, buttons & possibly a picture boxes too.
Basic functions like IF THEN ELSE, *, -, %, +, /, =, contains, yes no cancel message boxes…
Passing data from one script to another and getting any data returned.
I know what you are thinking tell them to install VB.net free edition! But I can’t as I need to add some bespoke functionality to extend the language also that allows communication with an in house system providing read and write to and from the system via existing COM objects.
Also the hosting c# app needs to contain many buttons each with the own script attached.
If this wasn’t bad enough the uses need to be able to write their own scripts so ideally some form of basic IDE is needed also.
Any suggestion?
Various technologies come to my mind which allow to implement parts of your requirements.
1.) Use Lightswitch for RAD forms
If you want to have a simple tool for rapidly building simple UIs you could use Lightswitch.
You could provide your own assemblies added as references in Lightswitch that act as a code Framework for the LightSwitch Application.
2.) Windows Workflow Foundation RuleEngine
The RuleEngine allows you to modify/store businessrules. You can bind your internal assembly to the RuleEngine and then you have the possbility to script code based on the bound assembly.
The rules are simple "If" "then" "else" statements.
http://karlreinsch.com/2010/10/18/wf-rules-unleashing-the-rule-engine-within-dot-net/
3.) Load XAML dynamically
With WPF you can serialize/deserialize UIs and load them from an file during runtime. With Blend or own tools you are able to create UIs and bind them to your business logic.
See http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/a53ff197-8703-4c6c-8726-45570304fb7b/
In the case your describing, I would suggest looking into already existing scripting techniques (perhaps such as LUA). You can then hook this sort of script up to existing code (such as an API you have built to leverage the functionality you desire).
The reason I suggest using an existing scripting system is because it has already been tried and tested, and it means you don't have to define a new language yourself and build the parsing engine.

Combining C# with C++ in a single project [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I am assigned a project in which there are two parts :
Database Programming
Game Programming
I am incharge of Database programming and my partner the later. But I am friendly with C-sharp Database programming as it is very efficient using Visual Studio. But he has a Game experience in C++.
Our target system is Windows 7,database will be Sql Server Database, and game can be in C or C++.
We will have a link in Windows forms that starts the Game.
How do we solve this problem without changing our partners?
From a technical point of view it is possible to write a project in multiple languages. From a practical standpoint it is not a good idea.
If this is a small project that will not be enhanced and will be write once and forget then it is fine, otherwise not.
You don't necessarily need to change partners, one of you just needs to step up and say they will jump the learning curve. As a programmer you need to be able to work in whatever language is required.
There are many factors that decide which language/library to use. Write them down with the pros and cons and decide which makes the most sense for your application. Agree that once this is settled then the topic will not come back up. Maybe find an neutral arbitrator that you can both elect to decide for you.
A partner is more than their ability to write code in a given language. The coding part is a small part of the project.
I suggest looking at Managed c++ and the /clr compilation switch for c++. Using managed c++ you can expose what you need to the .net world using .net objects where appropriate, but use native c/c++ code internally.
Managed c++ also have alot of ways to integrate efficiently with .net, such as object pinning (no relocation by the gc)
c++ compiled with /clr can be consumed from any .net language like a regular .net assembly. c++ code compiled this way can also consume any .net assembly much like the other .net languages do.
You haven't provided much details about this game but can't you Process.Start the Game from your WinForms application and passing it the necessary parameters that you fetched from the database?
Another option would be to wrap the database in a COM object developed in .NET that the game, if written in C++ can consume.
I am working on a project right now (and recently completed a similar one) that combined C#, and C++ libraries using C++/CLI. The data collection and signal processing were all written in C++ (your game piece) and the forms, xml and plotting was all done in C# (your db piece). C++/CLI handled the impedance mismatch between the two languages. I actually ended up writing little more than a mediator class in C++/CLI (I find it much more pleasant to write in C#). I think this would work for you too. The only issue is that C++/CLI is not C++. In fact I would suggest that the C# programmer learn C++/CLI rather than the C++ programmer. My reasoning is that syntactical differences between the languages are rather trivial and the C# programmer can probably learn those faster than the the C++ programmer coming to grips to what managed code and .NET is all about. That said, if you both took responsibility for the C++/CLI piece you would have all the skill sets needed to tackle it with the minimum amount of pain.

What are some advantages to the different programming languages? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I have always had an interest in coding, and a while back a started to learn C#. Since I only do this as a hobby, i have been learning it very slowly and don't know too much yet, but when I started to read about C++ and how it runs closer to the OS, I started to wonder if I should start learning C++ instead. I know html and JavaScript pretty well and to me C# seemed to be somewhat similar to js, so it wasn't to hard. I just downloaded C++ Express and noticed it is in a very different style than what I'm used to. I'm wondering if I should stick with c# or try c++ (especially if I want to start playing with Arduino sometime in the future). What are some advantages/ disadvantages to both?
As a person who has done all of these languages professionally, I would say that C# is probably the easiest to learn while still being very powerful. There is a lot of help for the .NET platform both from the libraries standpoint and from the community as well. Unless you really want to get down and dirty with a language, stick with C#.
The bigger answer, however, is "it depends". If you are looking to learn a language for the sake of learning one, C# is the way to go. However, if you are thinking about possibly using this new skill in a job setting, look for what type of job you want and decide from there. If you are looking to build applications for yourself and your friends, stick with C#. You can build a Winforms app in about five minutes and you can scale to larger and more professional apps easily from there. C++ will be much more difficult to do the same with.
Coming from Javascript, I would probably recommend staying with C# if you don't want to get down and dirty with details. It will take care of memory management and several other low-level concerns that C++ makes you deal with manually, so it's a little less of a shock to go from an interpreted scripting language like Javascript or Python or Ruby to C#. It's kinda half-way between them and C++.
That said, if you want to learn more of how programming languages and computers in general work, go for C++. It's more complicated than C#, but learning C++ very well makes any language you learn after that easy. Plus with C++, there's virtually no limit to what you can do (C# imposes a few limits), and you pretty much have the entire computer with all its speed and resources at your disposal.
That said, C++ usually takes longer to do the same thing in. For instance, creating a Windows application with a GUI and everything would take a considerable amount of time in C++, but in C# it's trivial. It's a tradeoff you have to deal with, but like I said, if you learn C++ first, C# is cake. The converse is not necessarily true though.
If you want to work with Arduino, go for C++ (never worked with Arduino but the code snippets looked like C so..). C++ is very similar to C, and most C will compile as C++ with very little modification.

How to write another Debugger for .NET using CLR [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I want to implement another debugger (language) for .NET (it's just for academic reason, so that it can implement just a part of a language). I myself like to implement NS2 (network Simlator 2) script for .NET in which anybody can write ns2 script and debug it with .NET
I read this article in stackoverflow and it is far from what I'm looking for.
Here is the requirement
have some predefined keywords (e.g: for, while, if ...)
check the correct form of the statements (e.g: for(start;end;counter){commands} ...)
diffferent colour for different types of statements
ability to add to any IDE (e.g: implementatin like add-in or as a dll or ...(I have no idea))
many other thing that is not necessary for now
How can I do this?
Update : I'm not sure that you got my point, take a look at this, it is very close to what I am looking for.
It will not be an easy task. However: The Dragon Book is probably a good place to start (assuming you've got sufficient computer science background for a compiler theory book to make much sense to you). Compiler Construction: Principles and Practice is also a good text.
You'll want to compile to CIL (common intermediary language). This handy wiki article outlines the CIL instruction set. Debugging your intermediate code against the CLR... well, that's where the StackOverflow article you've linked will come in handy =)
That'll cover your first two bullets (and consume a big chunk of your life).
The next two are different issues, but the easiest way to 'make it go' would probably be to define a syntax for an existing text editor, and set up a macro in the program to call your compiler. I'd recommend TextPad, though I'm sure opinions on a configurable general-purpose text editor will vary among the community ;)
Designing a full IDE with all of the features you've come to know and love in your environment could be quite a task ... or you could try to build an eclipse plugin. Personally (assuming you can design your language and learn something from it), I'd just stick with syntax highlighting in TextPad.
There is more and more interest in this area and in fact there is an active project by Microsoft Research that is looking at this on building a common infrastructure to build compiler (and debugger) for custom languages targetting .NET
http://cciast.codeplex.com/
I have used the infrastructure myself but not an expert in compiler technology. Hope this gives you a good starting point and you may find the discussion forum useful to share idea with like minded people.

Categories