[.net] designing in .net

Started by
4 comments, last by nuvem 19 years, 4 months ago
Hi! I recently started programming in c#. Found it very easy, since I had programmed som Java and a lot C++ before. Now, I'm used to make interfaces for everything :) But now that I'm programming c#, maybe I'm overexaggerating ? My main concern is the core functions like FileStreams and stuff like that. In C++ I had to abstract everything to make it crossplatform, but I hear that there will be some sort of .net drivers for unix as well? So I might just as well use the core functions for FileStreams etc? Thx!
Advertisement
In theory, C# will require the .NET common runtime to work, regardless of the hardware or OS it runs on, so you can use any .NET component in your program safely, knowing all .NET implementations are supposed to behave the same way.
I had a similiar problem abt a year ago when I started on .NET. More specifically I was doing something silly with DLL's (Assemblies) ie. Having a DLL Exporter factory that would get me the correct class at runtime.

This was a good design in C++ using export functions
eg.

HRESULT WINAPI DLLQueryObject(REFIID riid, void** ppvObj);

called with

CMentalRayRender* r = NULL;
... //dll loading and GetProcAddress here ...
dllPROC(IID_IMentalRayRenderer, &r);

This DOES NOT need to be done in .NET.
All u do is ..

using MentalRayPlugin;
...

MentalRayPlugin r = new MentalRayPlugin();

One has to think and design differently in .NET as there is no need for certain "tricks" that one used in C++. eg. exporting pointers/classes from DLL's.

And so on and so forth ...
Ok, thx guys!
Don't program in .NET expecting to make cross platform programs or you may be disappointed for awhile.

This might answer some of your questions...

This topic is closed to new replies.

Advertisement