DEV Community

Salim Mejdoub
Salim Mejdoub

Posted on

Moving from PHP to C#

Hello community,
I want to have your oponion abour moving from php to c# after 5 years of developing with php.


Discussion (3)

fxcosta profile image
Felix Costa

Hello! I had to do this migration, forcibly, because I am in a project with .NET Core. It was not so painful because I already had a notion of C# in Unity3D but I needed to understand and adapt to different features of the language. Some tips I can give you:

1 - Study the C# data structures. Unlike PHP with Arrays, C# is more bureaucratic and for each type of data you can have different structures: HashSet, List, Dictionary, etc.

2 - Depending on your background with PHP and OOP, you will notice that in C# we are more "obliged" to use key OO concepts such as interfaces, abstract classes, polymorphism. Be sharp with that.

3 - You will probably come across Generics, which is a very nice feature but which does not exist for PHP, so it must be a little complex to understand at first but it is worth knowing.

4 - The general syntax of the language is not complex. It is very inviting for making use of new features like lamba functions (known as arrow functions in javascript, etc.). Try to adapt some algorithms in PHP to C# and compare how each solves the problem. It will help in your adaptation.

5 - Start to be updated about the .net ecosystem (if you are going to work with this framework). C# has great libraries that facilitate development.

Hope this helps

salimmejdoub profile image
Salim Mejdoub Author • Edited on

Hello Felix,
thanks for the reply and for your advices,
i agree with you 100% ,
but for now, i found it very easy to migrate from php to c#, and i found the .netCore && wpf very cool also. it's worth it to learn it

adammarton profile image
Adam Marton

Why did I received this in a promoted email from DEV?