Jump to content
  • Advertisement
Sign in to follow this  
jagguy

.net?

This topic is 4409 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am new to .net work and the term is confusing me. I have been using vc++ and the .net keywords are everywhere on help screens. BY using .net what advantage do you get over not using it, is it more graphical, easier to use than COM is the old way I believe. Is c++ easier with it? PS I am not a fan of learning another language like c#. Is .net for win systems only?

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by jagguy
BY using .net what advantage do you get over not using it, is it more graphical, easier to use than COM is the old way I believe.
First you have to know what .NET is. The .NET Framework is a set of tools used to help you create applications easier and quicker. Rapid application development is what they call it...

Quote:
Original post by jagguy
Is c++ easier with it?
C++ and C++/CLI are actually really quite different. While they both stream from the same "C++" name, the way they function is almost completely different. By learning C++/CLI, you'll have to learn not only a whole new set of keywords, but also the tools available behind .NET .

Quote:
Original post by jagguy
PS I am not a fan of learning another language like c#.
Maybe you should, C# is amazingly easy to learn when compared to C++, especially when compared to C++/CLI. And you'll be able to carry the knowledge you've learned in C++ and transfer it over to C#.

Quote:
Original post by jagguy
Is .net for win systems only?
Nope, you can usually compile the code using Mono and have it run on Mac, Linux or Windows, without even having to compile again. You can even compile your code using .NET and be able to run it on Linux/Mac through Mono, if it's a simple application.

Share this post


Link to post
Share on other sites
I'm going to try to explain this without looking in the book...

.NET is Microsoft's brand name for another platform. It comes in the form of a framework that the end user installs on their computer. It can be compared to Java because they are similar in how they work.

So, like Java, the end user will need to have the framework installed in order to run any programs written for it.

.NET was Windows only, but there is an open source project called Mono that will allow .NET to work on other operating systems like Linux and MacOS X.

.NET gives the programmer a pretty standard way for performing many common tasks. I guess it can be compared to an API in how the programmer interfaces with it, but it is something entirely different.

You can derive your own classes from classes in the framework.

Most of the classes and methods in .NET are geared towards programming Windows apps and business solutions, nothing really game related. That's not to say that you can't benefit from it by choosing it for your game.

.NET is pretty much the future of Windows. In the future, all Windows programming will be .NET.

Just to give an example of how easy it makes things, say you have an int _Int. You can easily convert it to a string without any extra external function from an API or anything just by saying _Int.ToString(). Intellisense makes things way easy.

Using C++ with .NET is not really beneficial. It complicates a lot of things. There isn't much benefit to using it.

And if you're not a fan of learning C#, I'm just going to say a few things. C# is a .NET exclusive language (as far as I know). It's very similar to C++. Now because it's .NET exclusive, you've got the garbage collector. Many things are way simlified from C++ and APIs and what not, but the difference might not suit your needs. Unmanaged C++ still executes faster than .NET, but is more prone to bugs. Here's the great part: I learned C# in like one day, just by sitting down with a tutorial (having already known C++). I got a 3D demo up and running in one night using C# and Managed DirectX. That's a lot faster than the 4+ months it took me to do the same thing in C++. The benefits of .NET are vast, it's just too much to explain; you have to try it to believe it.

Visual Basic is pretty much the same deal except for the lack of unsigned variables and case sensitivity (and a few other things).

Now, Managed C++, which is what you're asking about, is still a lot more simple than using APIs, but it's still more complicated than C# in that it still takes more lines of code to do the same thing. I haven't done any serious .NET programming with C++, so I can't really note the differences, but you will prefer C#, guarantee. It's not that different from C++.

I think the biggest benefits are in security; no need to worry about buffer overflows or anything. Sure, security holes do show up every so often, but they are usually patched quickly.

Oh, and one more really big benefit: Squigly underlines. when using C# or VB, if you try to do something that you're no supposed to do, Visual Studio will show you squigly underlines on the problemed code. If you forgot a semicolon, it will show you. You can also include semicolons at the end of your lines in Visual Basic with the special semicolon prefix character, '.

Also (I can't stop), compiling is fast. If you compile and have a varible that you never use, it will tell you. Debugging is easy. If you choose to rename a variable, it will rename every other instance of it accross the project to the new name (if you want it to).

I hope this post wasn't all fluff and no stuff; It's pretty much just my experience with .NET.

Ugh, too long...

I'm still using C++ though because of performance benefits (although the time it takes to do anything useful is still a long time).

Share this post


Link to post
Share on other sites
Oh yeah, don't let the name .NET throw you off; It doesn't have anything to do with being network exclusive (I suppose it's called .NET because busness apps almost always involve a remote database of some sort (the name has recieved a lot of critisism as it was Microsoft's decision to name it that for marketing purposes (confued a lot of people when it first came out))). I think it's the name of one of the namespaces in the framework though (System.Net).

Share this post


Link to post
Share on other sites
Quote:
Original post by Ridiculous
You can also include semicolons at the end of your lines in Visual Basic with the special semicolon prefix character, '.

This baffles me; the ' character is the comment character. All you're doing is adding a semicolon as a comment.

Under Visual Basic, rather than have code spanning multiple lines as the "norm" (like C-based languages) that you have to explicitely end with a ;, you can use the special _ character to break code into multiple lines.

Share this post


Link to post
Share on other sites
with .net the idea is that you can us eit with either language like c# or vb.net etc. Now if you want to run your apps on linux from c#,asp.net or vb.net can it be done exactly if at all ?

Share this post


Link to post
Share on other sites
Quote:
Original post by Rob Loach
C++ and C++/CLI are actually really quite different. While they both stream from the same "C++" name, the way they function is almost completely different. By learning C++/CLI, you'll have to learn not only a whole new set of keywords, but also the tools available behind .NET .


That is a bit misleading. C++/CLI is a superset of C++. In otherwords, its exactly the same as C++ with CLI stuff on top. You can mix and match C++ and C++/CLI code to a certain degree, or you can take standard C++ code and start adding managed .net code to it. There are special rules and gotchas, but thats a bit beyond the scope of this conversation. Everything else is correct.

Share this post


Link to post
Share on other sites
Quote:
Original post by Ridiculous
Using C++ with .NET is not really beneficial. It complicates a lot of things. There isn't much benefit to using it.


Thats a matter of opinion. Personally if im doing .NET work, I use C#, but again thats a matter of opinion.

C++/CLI is very beneficial in some areas:
* Moving existing C++ code to a managed environment
* If your comfortable with C++ but are sick of win32 or MFC
* If you want to mix and match managed code for conveinence with unmanaged code for performance. Granted, you could do wrappers or pInvoke calls from C# or VB.Net, but it actually is easier with C++
* Better optomizing compilier for a managed language then either VB or C# ( this is from a friend on the Visual Studio dev team... not my own opinion )

I have only used managed C++ a few times, once was to do tools for a C based 3d engine ( CipherEngine ) where I didnt want to take all the time wrapping it for C# use. It worked like a champ. Although, again in my opinion, the syntax looks terrible.

Today, if I had to do a windows only GUI app in C++, I would use .NET in a heartbeat over MFC, wxWindows or Qt.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
.NET basically defines a standard for language interoperability. All .NET languages down-compile to a language called CIL - Common Intermediate Language. At run-time, the CIL is JIT-compiled (JIT is "just in time") into native CPU instructions. Note that each method/function is only compiled once. There's a small performance penalty upon application startup, and then everything is pretty much as fast as native code (C/C++, etc.)

What's great about C++/CLI is that it supports standard C++ completely, with much more compliance than VC++ 6. It also provides extensions that allow you to use C++ and .NET together. C++/CLI has the advantage that it can switch between native and managed (.NET) code in the same application - in fact, even in the same file. C++/CLI is great for things like wrapping low-level API's such as DirectX or OpenGL into a DLL that ANY other .NET language can use.

Basically, if you want to do .NET (which you should for almost anything except the next big 3D game), use C#, Visual Basic .NET, J#, or the .NET language of your choice - remember, they all support a common base of functionality with a few additional features specific to each. If you want to expose a native library to .NET, use C++/CLI. If you REALLY care about performance (which you might if you're writing some sort of D3D10 app or something), you can use C++/CLI and turn of CLI support, and hey presto! no penalty is incurred.

BTW, Ridiculous, I think I'm going to save a link to your post and present it the next time a "C++ vs. C#" topic pops up.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by Anonymous Poster
What's great about C++/CLI is that it supports standard C++ completely, with much more compliance than VC++ 6.

Not quite. There are some subtleties. c++/cli is constrained by the underlying unified type system a bit. multiple inheritance of non-interface types (which most c++ coders seem to concider a 'Bad Idea' anyways...) isn't possible in c++/cli because basically the clr doesn't allow it. Also there are some constraints in the c++/cli compiler frontend hat are not present in the native c++ compiler like the maximum length of names for template parameters.. subtle stuff.. but nerve wrecking for template fetishists ;)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!