• 0

Going to C# from heavy Python experience


Question

Hey there! I'm a noob and I need help.

 

 

I've been given certain liberties on my companies next GUI adventures and after enough research I've decided I'm going with Visual C#. The ease of Visual Studio with the friendliness of C# seems like an excellent combination. The only problem is.... I don't really know C#. I get the basic Syntax, it's pretty straight forward as I have quite a bit of experience with PHP (and less so with C) but I know I need to drastically improve. Partial Classes, for example, scare me. Although so does this odd thing known as compiling and strong typing.

 

 

Answer Guide:

Keep in mind I'm a visual person and have never been very good with books. Sure I can read and comprehend but I have a much easier time with watching by example and taking apart other peoples code on github or something. This doesn't mean I don't want books, just that they are second fiddle.

 

Question:

As a heavy Python3/Qt4/MySQL programmer where is the best place to start learning C#?

 

Are there any projects you know of written in C# that would be easy for me to dissect?

 

Do you have any experience with both Python and C# and know a thing or two about important differences / "gotchas"?

 

 

Thanks a ton!

14 answers to this question

Recommended Posts

  • 0

If you've done a lot of any object-oriented language then the syntax of C# should not be a huge issue. Stackoverflow has an awesome C# community, if you ask a question there it usually gets answered in 5 minutes. I'm an expert on C# and .NET so I can probably answer most of your questions as well.

 

I think the bigger change from Python is getting to know .NET, the underlying platform: how code is compiled into assemblies, how assemblies can reference each other, how garbage collection works in regards to reference and value types, all the basic types in the root System namespace (Object, String, Type, etc.) that sort of thing. .NET is a wonderful development environment with excellent documentation, comprehensive, high quality libraries, and this is reflected in many independent open-source projects that build on the platform. Personally, I'm totally spoiled and wouldn't use anything else these days. C# was consistently designed as a "pit of success": usually the most obvious thing to do is the best thing to do (unlike in some other *cough languages).

 

If you're going to do GUI programming, WPF can be a pretty tough pill to swallow. Try to focus on one thing at a time.

 

Coming from Python you're likely used to exploratory programming inside the REPL. Visual Studio doesn't provide a C# REPL, but LINQPad is a great alternative.

 

I'm not convinced of the value of learning by reading other code; perhaps you can understand it but it'll be hard for you to figure out why it was coded this way. A really good book for experienced programmers is C# in a Nutshell. For an in-depth treatment of the .NET platform (once you have some experience with it), read CLR via C#.

  • 0
  On 03/06/2014 at 01:02, Andre S. said:

. . .

 

I'm glad you're an expert. For the most part I'm fairly self-sufficient but I may ask direct C# questions from time to time (so long as I haven't found something on S.O. yet).

 

I agree on C#, it looks like a wonderful language so far and I'm a bit disappointed I overlooked it the first time around. I believe there were some issues with Linux compatibility at the time that immediately removed it from my "check it out" list. Now that's no longer of concern.

 

I've been working out the Windows Form Application but haven't touched WPF; I'll stay away for now. WFA however is very straight forward and simple.

 

I don't really touch the REPL much these days but I agree it was a big help in the beginning, I'll take a look a LINQPad. Thanks.

 

I read other peoples code not to understand the syntax but the reasoning. I don't generally get into that until I have a firm grasp of the language, but the one thing I don't want to happen is code Python in C#. There is a C# way of doing things and in general other peoples code are a good indicator of those methods. I've never been formally taught so I have to learn formalities and methodologies the hard way, unfortunately.

 

Thanks for the help. I'll check those books out.

  • 0
  On 03/06/2014 at 01:31, astropheed said:

I've been working out the Windows Form Application but haven't touched WPF; I'll stay away for now. WFA however is very straight forward and simple.

It's usually referred to as WinForms. ;)

  • 0
  On 03/06/2014 at 01:02, Andre S. said:

.NET is a wonderful development environment with excellent documentation, comprehensive, high quality libraries, and this is reflected in many independent open-source projects that build on the platform. Personally, I'm totally spoiled and wouldn't use anything else these days. C# was consistently designed as a "pit of success": usually the most obvious thing to do is the best thing to do (unlike in some other *cough languages).

 

I'm having a really good time with it so far. I wish I got into this much sooner.

 

Update:

I enjoy the type system. I didn't think I'd like strongly typed languages (I didn't like it in C) but I actually find it gives a certain peace of mind after a while. I'm not a fan of using the 'new' keyword to instantiate a new object reference (and arrays), but, I guess I'll just have to deal (I'm not a big fan of the explicit 'self' parameter in Python methods either, so...win some, lose some).

 

I've got the basics down, including Structs, Enums, Classes, Arrays and anything easier than those. Having a heck of a time. I haven't touched generics or threads, but I don't think they'll be too difficult. Time will tell.

  • 0
  On 05/06/2014 at 01:48, astropheed said:

I'm having a really good time with it so far. I wish I got into this much sooner.

 

Update:

I enjoy the type system. I didn't think I'd like strongly typed languages (I didn't like it in C) but I actually find it gives a certain peace of mind after a while.

To be precise, C# is statically typed whereas Python is dynamically typed, i.e., every identifier has a fixed type which can be figured out just by looking at the code, whereas in Python types are assigned and can change at run time. The terms "weak" and "strong" typing don't have well-defined meanings.

 

Glad to know you're having fun with it!

  • 0

I always recommend csharp-station to people looking to learn C#. The tutorials are well written, short enough not to feel overwhelming, but long enough to give you all of the basics that you need. And as Andre suggested, Stack Overflow is an invaluable tool. Definitely consult that site when you run into a problem.

  • 0
  On 05/06/2014 at 01:59, spacer said:

I always recommend csharp-station to people looking to learn C#. The tutorials are well written, short enough not to feel overwhelming, but long enough to give you all of the basics that you need. And as Andre suggested, Stack Overflow is an invaluable tool. Definitely consult that site when you run into a problem.

 

Right now I'm reading "C# Yellow Book" by Rob Miles. I like the way he breaks things down with some light humor thrown in. After which I will read "C# in a nutshell" which I've ordered online and just waiting to arrive. If by the end of that 1000 page "nutshell" I need a bit more I'll take a look at your suggestion. I'm also reading "Code The Hidden Language" and "The C Programming Language" in the meantime as suggested by Joel Spolsky from Stack Exchange. 

 

I just can't take on anymore books right now lol. I will however look into it.

 

 
  On 05/06/2014 at 01:59, Andre S. said:

C# is statically typed whereas Python is dynamically typed

 

Sorry, still not very good at terminology. I'm a decent to pretty good programmer, but as I was all self taught the terminology sometimes escapes me; if I even know it at all.

  • 0
  On 05/06/2014 at 01:48, astropheed said:

Update:

I enjoy the type system.

 

Small note about that. The types in C# are aliases for the actual types in .NET. In that fashion, int is an alias to Int32, long to Int64, and so on. You might find it sometimes to be more appropriate to use the .NET types, particularly if you share code with non-C# .NET developers (VB.NET, F#...). They would know exactly what the types are, instead of going through C# documentation to read on what "long" means.

 

It is something so simple, and it really depends on your usage, but it is something to give a thought or two about. Personally, I've started to use the .NET types, thus I'm getting a clear distinction between types and other C# keywords (they're not with the same colour). Not that it matters that much, but still, I like my cake this way! :laugh:

  • 0

I personally go by what the language specification recommends:

 

  Quote
Each of the predefined types is shorthand for a system-provided type. For example, the keyword int refers to the struct System.Int32. As a matter of style, use of the keyword is favored over use of the complete system type name. http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-334.pdf (page 18)
  • 0
  On 05/06/2014 at 02:30, elenarie said:

Personally, I've started to use the .NET types, thus I'm getting a clear distinction between types and other C# keywords (they're not with the same colour). Not that it matters that much, but still, I like my cake this way! :laugh:

 

  On 05/06/2014 at 04:08, Andre S. said:

I personally go by what the language specification recommends

 

 

I have to take one of your sides, and Andre is Green. If Ruby Rod taught me anything it was that it must be green. Thanks guys though, I'm glad I know it's an alias.

  • 0

It seems like you are well on your way with C# and the .NET framework. My story was different... I started with C# etc... but switched to Python because of its no brainer syntax. However, my days with C# is far from over and I still sometimes go back to it when I am building a web based enterprise application. .NET has some awesome libraries that makes things much faster.

 

Anyhow, I would feel really bad if you found the following tools later than now. I don't want you to spend your wheels and waste too much time because the following tools and resources made my applications look super awesome even though I was still a complete noob ;)... don't tell that to my employers now!

 

DevExpress

https://www.devexpress.com/

 

Excellent .NET controls for ASP.NET and C# desktop applications.

 

Total Training for .NET/C#

http://totaltraining.com/store/asp-net-2-0-building-web-applications-bundle/

http://www.youtube.com/playlist?list=PL25CE22D4AA564934 ;)

 

Probably the best video tutorial series I came across for .NET stuff. The basic C# was well enough but the ASP.NET part also made me very comfortable toward the web.

  • 0
  On 09/06/2014 at 16:02, roosevelt said:
<snip>

 

DevExpress

https://www.devexpress.com/

 

Excellent .NET controls for ASP.NET and C# desktop applications.

 

<snip>

 

Personally, I'd stay away from those if at all possible, far too much bloat ;)

  • 0
  On 09/06/2014 at 16:02, roosevelt said:

It seems like you are well on your way with C# and the .NET framework. My story was different... I started with C# etc... but switched to Python because of its no brainer syntax. However, my days with C# is far from over and I still sometimes go back to it when I am building a web based enterprise application. .NET has some awesome libraries that makes things much faster.

 

Anyhow, I would feel really bad if you found the following tools later than now. I don't want you to spend your wheels and waste too much time because the following tools and resources made my applications look super awesome even though I was still a complete noob ;)... don't tell that to my employers now!

 

DevExpress

https://www.devexpress.com/

 

Excellent .NET controls for ASP.NET and C# desktop applications.

 

Total Training for .NET/C#

http://totaltraining.com/store/asp-net-2-0-building-web-applications-bundle/

http://www.youtube.com/playlist?list=PL25CE22D4AA564934 ;)

 

Probably the best video tutorial series I came across for .NET stuff. The basic C# was well enough but the ASP.NET part also made me very comfortable toward the web.

 

Ah, thanks for that. I may at some point actually use devexpress, very pretty.

 

As for the video series, thanks but I have little interest in using ASP.NET.

  • 0

Not sure if someone has already posted this or you have already looked at but check out http://code.msdn.microsoft.com/

 

You can pretty much get any code sample by filtering it from the left.

 

For 3rd party WinForms controls, I can vouch for DevExpress controls. Been using them since 2003. Great controls and excellent support and cuts down a lot of development time.

This topic is now closed to further replies.
  • Posts

    • Do you have a 365 account? I should have been more clear, I mean free accounts.
    • What?! "May 31 2024 knowledge cutoff"?
    • Amazon Alexa+ now has more than a million users by Aditya Tiwari Amazon's muscled-up voice assistant, Alexa+, has reached a new milestone. A company spokesperson told The Verge that Alexa+ has now crossed one million users. The e-commerce giant introduced Alexa+ earlier this year as its generative AI offering. Why? It's a new trend, and everyone is doing it. According to the company, Alexa Plus offers more natural and free-flowing conversations than its predecessor. You can speak half-formed thoughts using colloquial expressions, and the AI assistant should be able to understand you and provide an answer. Announcing its capabilities, Amazon previously said that you will be able to start a conversation on your Echo device and continue it on your phone, car, or computer. One million may not be a significant number when comparing it with the number of Alexa-enabled devices out there. Amazon revealed earlier this year that there are over 600 million Alexa devices globally. However, the number of Alexa+ users has increased from 'hundreds of thousands' in the previous month. The user base is not as big as that of other names like Gemini and ChatGPT because Amazon is still offering the generative AI assistant through an Early Access program, available to Prime and non-Prime members who own a compatible Echo device. We can find social media posts from different users who have been invited to try Alexa+. While there have been positive reviews from some, the road isn't buttery smooth for others. One user claimed that the early access Alexa+ has problems accessing some temperature sensors the previous version of Alexa would. "I also really dislike how it confidently will tell me something that is incorrect now instead of just saying it doesn't know like it used to tell me," the user added. The upgraded AI voice assistant will cost $19.99 per month, but is being offered for free to Prime subscribers. Alexa+ started rolling out in the US as part of its early access program. One reason why Amazon is giving Alexa+ a slow rollout is that the new devices and services chief, Panos Panay, wants to eliminate all the problems related to the generative AI assistant. Amazon's spokesperson told the publication that the early access program doesn't include features like brainstorming gift ideas, scheduling your next spa visit, ordering groceries hands-free, and jumping to your favorite scene on Fire TV. The program also doesn't offer the "new browser-based experience at Alexa.com," which would put Amazon's AI assistant in line with ChatGPT and Gemini. These missing features will be added in the coming weeks and months, as per the spokesperson, adding that almost 90% of the features are now a part of early access.
    • MSI's 32-inch 4K QD-OLED gaming monitor gets a big price cut for UK gamers and professionals by Paul Hill If you’re a gamer in the UK and looking for a monitor to upgrade to then check out the MSI MPG 321URX QD-OLED 31.5 Inch 4K UHD Gaming Monitor which you can now pick up for just 75% of its recommended retail price. The RRP of this monitor is £1,199, but thanks to this deal, you can get it for just £898.99 for a limited time (purchase link down below). With its 4K display, 240Hz refresh rate, and 0.03ms GTG, you’ll have the edge over other gamers by avoiding lag. At 31.5-inches, it’s the ideal monitor size if you’re sitting up close to it at a desk, you don’t want it too big at such a short range, but you also want to be able to see all the image details so 31.5-inches is a good balance. What makes QD-OLED stand out? There are loads of terms used to describe displays such as AMOLED, OLED, LED, and it can all get a bit confusing. This monitor adds yet another acronym called QD-OLED, which stands for Quantum Dot OLED. For you as a buyer, this means your new monitor has self-emitting pixels that deliver great black levels. It also features an enhanced sub-pixel arrangement for extra sharpness. The 31.5-inch 4K UHD monitor has a 3,840 x 2,160 pixel resolution making it ideal for playing games, but also watching movies in the best quality. Other important features worth mentioning are the 1.07 billion colors (10-bit) that the monitor can produce, its 99% DCI-P3 support, and DisplayHDR True Black 400 certification. All of these things make the monitor produce more accurate colours, potentially making it a good choice for professionals editing videos and photos too. Obviously, games will look good too. MSI has also packed in a fanless graphene heatsink which should help to increase the durability of the monitor long-term. This could extend the time until you need to buy a new monitor, further justifying its almost £900 price tag. Gaming and productivity features It’s not just the hardware that makes this monitor excel for gaming, it also comes with great software enhancements and connectivity options. On the software side, you get the following features: Smart Crosshair: Projects a customizable crosshair onto the screen to improve hip-fire accuracy and iron sights in first-person shooter games. Optix Scope: Gives you a built-in aim magnifier with multi-stage zooming and shortcut keys to quickly switch magnification levels. AI Vision: This automatically enhances brightness and colour saturation, particularly in dark areas of the screen, making it easier to see enemies hiding in shadows or dark corners. If you have two separate systems you want to connect to the monitor at once, you can do so with this monitor thanks to KVM support. You can view both sources with Picture-in-Picture and Picture-by-Picture modes. The MSI MPG 321URX QD-OLED 31.5 Inch 4K UHD Gaming Monitor also supports next-gen consoles with features like HDMI CEC Profile Sync, HDMI Variable Refresh Rate (VRR), and 4K:4K downscaling. In terms of connectivity and ergonomics, you get DisplayPort 1.4a, 2x HDMI 2.1 (CEC), USB Type-C with 90W power delivery, and a USB hub. The monitor uses a tilt-, swivel- & height-adjustable stand that is VESA compatible. Should you buy this monitor? The MSI MPG 321URX QD-OLED 31.5 Inch 4K UHD Gaming Monitor is definitely a product for serious gamers looking for top-tier visual fidelity and performance or content creators who need accurate colours and high resolution. Even with the significant discount, it’s still at a premium price and definitely not for everyone. If you are in one of the groups mentioned, then you should give serious consideration to buying the MSI MPG 321URX QD-OLED 31.5 Inch 4K UHD Gaming Monitor as it's the lowest price the monitor has been at on Amazon to date. MSI MPG 321URX QD-OLED 31.5 Inch 4K Gaming Monitor: £898.99 (Amazon UK) / RRP £1,199 This Amazon deal is U.K. specific, and not available in other regions unless specified. If you don't like it or want to look at more options, check out the Amazon UK deals page here. Get Prime, Prime Video, Music Unlimited, Audible or Kindle Unlimited, free for the first 30 days As an Amazon Associate we earn from qualifying purchases.
  • Recent Achievements

    • Enthusiast
      computerdave91111 went up a rank
      Enthusiast
    • Week One Done
      Falisha Manpower earned a badge
      Week One Done
    • One Month Later
      elsa777 earned a badge
      One Month Later
    • Week One Done
      elsa777 earned a badge
      Week One Done
    • First Post
      K Dorman earned a badge
      First Post
  • Popular Contributors

    1. 1
      +primortal
      533
    2. 2
      ATLien_0
      273
    3. 3
      +FloatingFatMan
      201
    4. 4
      +Edouard
      200
    5. 5
      snowy owl
      138
  • Tell a friend

    Love Neowin? Tell a friend!