PDA

View Full Version : compiler for C#?




twoodcc
Jan 8, 2007, 03:38 PM
ok, so the new semester begins, and i'm taking intro to programming with C#.

can i do this with OS X, or should i install windows through bootcamp?

thanks



bousozoku
Jan 8, 2007, 03:57 PM
You might do a search on Mono. It's the non-Microsoft .NET environment. I'd imagine that there is already a C# compiler but I haven't looked for one.

Grover
Jan 8, 2007, 04:00 PM
Whether or not you can do it in part depends on whether you are going to need to do any GUI programming. If all you're developing are command line tools and you're staying within the core of C# (not using anything from Windows-specific .NET namespaces) then you can probably use Mono with no problem. The Mono documentation will tell you what's implemented and what's not. That might help you decide. Take a look at http://www.mono-project.com/Main_Page. I haven't tried it so I can't recommend it but you can also take a look at http://www.dotgnu.org/.

Things may have changed but my experience in school was that professors like uniformity so you may want to ask before using what may be considered a non-standard dev environment.

jalagl
Jan 8, 2007, 05:13 PM
I tried Mono, and, even though the API support is really coming together (specially for web pages), still has some way to go to match the .NET support found in Windows.

I would recommend that you start in Windows with the freely available Visual Studio Express (http://msdn.microsoft.com/vstudio/express/). You can get the C# version and start coding. A good site to start learning is Microsoft's Coding4fun (http://msdn.microsoft.com/coding4fun/), and obviously MSDN (http://msdn.microsoft.com/).

And, if you only need the compiler + documentation, you can download The .NET Framework SDK (http://msdn2.microsoft.com/en-us/netframework/aa731542.aspx).

twoodcc
Jan 8, 2007, 07:00 PM
thanks for the replies. i download Mono, and i'm trying to install a plugin for Xcode, but i can't figure out how to install it yet.

i'll probably just install windows via bootcamp though.

twoodcc
Jan 8, 2007, 10:11 PM
well i finally got Mono working in Xcode. so can i compile something that will also work on windows as well?

twoodcc
Jan 9, 2007, 01:02 AM
well after i created a test program in xcode, i can't seem to complie it. or at least i don't think so. it made an ".exe" file, but when i try to run that file on my roommate's pc, it doesn't really do anything.

here is my code:

//
//
// Test
//
// Created by Tim Wood on 1/8/07.
// Copyright 2007 __MyCompanyName__. All rights reserved.
//
//

using System;
using System.Collections.Generic;
using System.Text;

namespace Test
{
public class Test
{
public static void Main(string[] args)
{
Console.WriteLine( woodtest.TextToDisplay());
return;
}
}
}

is this code any good?

how can i make it work in windows?

thanks

kainjow
Jan 9, 2007, 01:11 AM
I think it should work on a PC, as long as they have .NET 1.1 installed. Also, since it's a command line app, make sure you execute it through the command prompt (Start > Run > "cmd").

twoodcc
Jan 9, 2007, 01:15 AM
I think it should work on a PC, as long as they have .NET 1.1 installed. Also, since it's a command line app, make sure you execute it through the command prompt (Start > Run > "cmd").

thanks. so after i go to the command prompt, how do i execute the program?

twoodcc
Jan 9, 2007, 01:20 AM
thanks. so after i go to the command prompt, how do i execute the program?

nevermind, we got it to run in the command prompt. thanks, i'm excited that it worked!

i wonder why you couldn't just double click the .exe file?

anyways, i'm just glad that it worked though:)

kainjow
Jan 9, 2007, 01:22 AM
thanks. so after i go to the command prompt, how do i execute the program?

You don't half to run it through the command prompt, but unless your program has a method of pausing, it will show up for a brief milisecond and then go away. That is why you need to run it through the command prompt, so you can see the program's output.

The easiest way is to drag the exe into the window, and hitting Enter.

twoodcc
Jan 9, 2007, 09:55 AM
You don't half to run it through the command prompt, but unless your program has a method of pausing, it will show up for a brief milisecond and then go away. That is why you need to run it through the command prompt, so you can see the program's output.

The easiest way is to drag the exe into the window, and hitting Enter.

oh ok, that's what i thought it was doing, but it was so quick that i couldn't tell if it showed anything in the command prompt that came up or not.

thanks, i'll remember to just drag the exe over next time.

thanks for the help :)

longofest
Jan 9, 2007, 04:06 PM
if you write a batch script and don't put "pause" in at the end, if you double-click it and it is a really short execution, it may flash before your eyes as well...

for instance, try making a batch script with just the command "dir" in there, and see how long it takes :)

twoodcc
Jan 9, 2007, 05:48 PM
if you write a batch script and don't put "pause" in at the end, if you double-click it and it is a really short execution, it may flash before your eyes as well...

for instance, try making a batch script with just the command "dir" in there, and see how long it takes :)

yeah, it was so quick it looked like the command prompt opened and then closed right away.

what does "dir" do?

Grover
Jan 9, 2007, 08:10 PM
"dir" does on DOS/Windows essentially what "ls" does on UNIX - it gives you a directory listing.

If you want your command line C# program to pause before closing add a call to Console.ReadLine() at the end of your code and the command prompt window will stay open until you hit return or manually close it.

twoodcc
Jan 9, 2007, 08:34 PM
"dir" does on DOS/Windows essentially what "ls" does on UNIX - it gives you a directory listing.

If you want your command line C# program to pause before closing add a call to Console.ReadLine() at the end of your code and the command prompt window will stay open until you hit return or manually close it.

can't you use "ls" in DOS/Windows also?

thanks for the tip. i might just try that for fun :)

kainjow
Jan 9, 2007, 08:39 PM
can't you use "ls" in DOS/Windows also?

65940

:D

twoodcc
Jan 10, 2007, 03:40 PM
65940

:D

well that answers my question. :) i guess i wasn't paying enough attention to what my roommate was typing

but i'm a little confused. i'm supposed to turn in a program after i compile it. but i'm supposed to turn in the .cs file. so why do i need to compile it if i'm only turning in the .cs file and not the .exe file?

Grover
Jan 10, 2007, 04:31 PM
Probably because it's a quick and dirty check that your program is free from the kinds of errors that the compiler can catch. If it doesn't compile then you know you still have work to do before submitting it. Think of it like this: if you were taking an electronics course you might be required to submit a schematic of a circuit you've designed. The teacher might, however, also require you to build the circuit so that you have some level of confidence that it's possible. In this sense what you're being asked to do is have your program in a runnable condition before you submit the source.

That said, the fact that it compiles doesn't guarantee that your program does anything or does what you intend but it does indicate that the program is minimally well-formed.

twoodcc
Jan 10, 2007, 05:40 PM
Probably because it's a quick and dirty check that your program is free from the kinds of errors that the compiler can catch. If it doesn't compile then you know you still have work to do before submitting it. Think of it like this: if you were taking an electronics course you might be required to submit a schematic of a circuit you've designed. The teacher might, however, also require you to build the circuit so that you have some level of confidence that it's possible. In this sense what you're being asked to do is have your program in a runnable condition before you submit the source.

That said, the fact that it compiles doesn't guarantee that your program does anything or does what you intend but it does indicate that the program is minimally well-formed.

thanks. after thinking about it i came to the conclusion that you need the compiler to make sure that your program works.