Forum > Beginners

What are main differences between free pascal and c#?

(1/8) > >>

DecayAssault:
Hi!
I have started from c# (WinForms, asp.net). Could I use Lazarus instead of them? Thanks a lot.

VisualLab:
C# is a language. Lazarus is a IDE (RAD) like Visual Studio or Delphi. The programming language used in Lazarus is Object Pascal (Pascal too). And compiler is Free Pascal.

C#:

* source code compiled to intermediate code (EXE or DLL are containers for byte-code),
* fully object-oriented - all code must be in classes (like in Java),
* poor support in systems other than Windows (but there is),
* language and tools entirely dependent on the "whim" of the corporate management (Microsoft), which in the absence of competition can be risks for /developers (for now there are Java and C ++)
Object Pascal:

* compiled to machine code (EXE, DLL),
* hybrid - source code does not need to be placed in classes,
* available on several platforms (Windows, Linux, Mac OS, etc.),
* the language and tools have little influence from their users/developers (small but better than none).

DecayAssault:
Thanks a lot.
Is there a way I can use to iterate strings like arrays?

Warfley:

--- Quote from: VisualLab on January 30, 2023, 11:08:22 pm ---
C#:

* source code compiled to intermediate code (EXE or DLL are containers for byte-code),
* fully object-oriented - all code must be in classes (like in Java),
* poor support in systems other than Windows (but there is),
* language and tools entirely dependent on the "whim" of the corporate management (Microsoft), which in the absence of competition can be risks for /developers (for now there are Java and C ++)
--- End quote ---
Thats a  bit outdated, First .net core, the cross platform alternative is widely used and supported, so while it provides a different set of base functionality compared to .net framework, it is quite stable and we'll established and allows for easy cross platform development

Secondly the language was made open source (the specification and also the tooling for .net core) and new features and developments are decided in direct cooperation with the community (any feature request that has a certain number of upvotes will be considered and at least be answered).
So it's not up to the whim of Microsoft, but actually pretty democratic.

That said if you need .Net for windows, this is still completely under Microsoft's control, and .net core and .net framework are quite different, so you need to decide early on what you want or need for a certain project


Aside from that, on a language level, the two languages are very different, so different that it does not make sense to list all the differences here.
The most important one is probably that C# is managed while pascal requires manual memory management

KodeZwerg:

--- Quote from: DecayAssault on January 31, 2023, 12:26:34 am ---Thanks a lot.
Is there a way I can use to iterate strings like arrays?

--- End quote ---


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---program Project1;// for windows that should be used to have console opened without need to check project options{$IFDEF MSWINDOWS}{$APPTYPE CONSOLE}{$ENDIF} // initialize two different kind of things for democonst  CString = string('Hello World!');  CArray : array[0..1] of string = ('Hello', 'World!');// define variables that we need for demovar  c: Char;  i: Integer;begin  // demo to iterate over a string  for c in CString do    Write(c); // display each char  // linebreak  WriteLn;  // demo to iterate over a array of strings  for i := Low(CArray) to High(CArray) do    Write(CArray[i] + ' '); // display each string (and add a space between)  // linebreak  WriteLn;  // for windows wait that user press return key  {$IFDEF MSWINDOWS}ReadLn;{$ENDIF}end.
Does that help?

Navigation

[0] Message Index

[#] Next page

Go to full version