Jump to content

How to remember C#

Go to solution Solved by Lengran,

You can programming while referring to the Unity manual or Google, it's fine and it's how I learned Unity. As a beginner you can expect that you remembered everything. After using it a lot, you will remember it naturally.

So Ive been trying to learn C# for unity development, however I am having trouble remembering how to use it. If I read somebody else’s code, I can point to most things and tell you what it can do (as I said, most things, not all) but I cannot remember how to properly write it. I have tri3d writing it, typing it, retyping and re writing multiple times, but I just can’t remember it. Any tips?

✧・゚: *✧・゚:*  Quote for a reply  *:・゚✧*:・゚✧

 

✧・゚: *✧・゚:*   Ask for discord   *:・゚✧*:・゚✧

Link to comment
https://linustechtips.com/topic/1021287-how-to-remember-c/
Share on other sites

Link to post
Share on other sites

You should remember it as an abomination...

 

Oh, sorry, I had only read the title. Is there a reason why you absolutely want to remember C#? Some languages choose their users rather than being chosen. Admittedly, I have a similar relation to Pascal: I can read it but writing it is more often than not related to a second browser window with code examples.

Write in C.

Link to comment
https://linustechtips.com/topic/1021287-how-to-remember-c/#findComment-12190405
Share on other sites

Link to post
Share on other sites

Schools will teach you that you need to memorize and know everything from within your head. Thankfully, the real world is not like this. I see no problem with looking up references online while working. But I doubt most people who code can do absolutely everything off the top of their heads either. They have to look up at least a few things here and there.

 

As for trying to remember how to properly write it, maybe try imagining yourself pointing at your own code and pointing out things, saying what it can do.

Link to comment
https://linustechtips.com/topic/1021287-how-to-remember-c/#findComment-12190438
Share on other sites

Link to post
Share on other sites

9 minutes ago, Dat Guy said:

You should remember it as an abomination...

 

Oh, sorry, I had only read the title. Is there a reason why you absolutely want to remember C#? Some languages choose their users rather than being chosen. Admittedly, I have a similar relation to Pascal: I can read it but writing it is more often than not related to a second browser window with code examples.

Unity 3d, it lets you use C# and JS, so I’m learning C# to develop

2 minutes ago, TempestCatto said:

Schools will teach you that you need to memorize and know everything from within your head. Thankfully, the real world is not like this. I see no problem with looking up references online while working. But I doubt most people who code can do absolutely everything off the top of their heads either. They have to look up at least a few things here and there.

 

As for trying to remember how to properly write it, maybe try imagining yourself pointing at your own code and pointing out things, saying what it can do.

Oh okay, thank you

✧・゚: *✧・゚:*  Quote for a reply  *:・゚✧*:・゚✧

 

✧・゚: *✧・゚:*   Ask for discord   *:・゚✧*:・゚✧

Link to comment
https://linustechtips.com/topic/1021287-how-to-remember-c/#findComment-12190454
Share on other sites

Link to post
Share on other sites

15 minutes ago, iLostMyXbox21 said:

but I cannot remember how to properly write it

How long have you been at it? Programming takes practice. It usually takes a some time when you first start out before you start to feel like you "get it". That's normal.

Gaming build:

CPU: i7-7700k (5.0ghz, 1.312v)

GPU(s): Asus Strix 1080ti OC (~2063mhz)

Memory: 32GB (4x8) DDR4 G.Skill TridentZ RGB 3000mhz

Motherboard: Asus Prime z270-AR

PSU: Seasonic Prime Titanium 850W

Cooler: Custom water loop (420mm rad + 360mm rad)

Case: Be quiet! Dark base pro 900 (silver)
Primary storage: Samsung 960 evo m.2 SSD (500gb)

Secondary storage: Samsung 850 evo SSD (250gb)

 

Server build:

OS: Ubuntu server 16.04 LTS (though will probably upgrade to 17.04 for better ryzen support)

CPU: Ryzen R7 1700x

Memory: Ballistix Sport LT 16GB

Motherboard: Asrock B350 m4 pro

PSU: Corsair CX550M

Cooler: Cooler master hyper 212 evo

Storage: 2TB WD Red x1, 128gb OCZ SSD for OS

Case: HAF 932 adv

 

Link to comment
https://linustechtips.com/topic/1021287-how-to-remember-c/#findComment-12190465
Share on other sites

Link to post
Share on other sites

3 minutes ago, reniat said:

How long have you been at it? Programming takes practice. It usually takes a some time when you first start out before you start to feel like you "get it". That's normal.

Inconsistently been trying for about a year, but I’ve been losing hope with it since I can’t hold onto it

✧・゚: *✧・゚:*  Quote for a reply  *:・゚✧*:・゚✧

 

✧・゚: *✧・゚:*   Ask for discord   *:・゚✧*:・゚✧

Link to comment
https://linustechtips.com/topic/1021287-how-to-remember-c/#findComment-12190487
Share on other sites

Link to post
Share on other sites

17 minutes ago, iLostMyXbox21 said:

So Ive been trying to learn C# for unity development, however I am having trouble remembering how to use it. If I read somebody else’s code, I can point to most things and tell you what it can do (as I said, most things, not all) but I cannot remember how to properly write it. I have tri3d writing it, typing it, retyping and re writing multiple times, but I just can’t remember it. Any tips?

Well you don't have much to remember really with all the greatness of the UI that Visual Studio is.

You have the snippets that does 99% of the job for you. You don't remember how to do a switch case or if statement CTRL+K then press X. They are all there.

 

You can create custom shortcut to your most used or create your own snippets. There are also add ins in the store that add a bunch of new ones that are more in depth like creating a class with observer pattern and TCP/IP features.

 

If you read and follow the coding guideline it become very easy. https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/inside-a-program/coding-conventions

Link to comment
https://linustechtips.com/topic/1021287-how-to-remember-c/#findComment-12190505
Share on other sites

Link to post
Share on other sites

3 minutes ago, iLostMyXbox21 said:

Inconsistently been trying for about a year, but I’ve been losing hope with it since I can’t hold onto it

I'm only familiar with unity at a surface level, but only part of using unity is actually using C#, correct? Perhaps picking up a project that has more programming and uses C# more consistently might give you a better foundation, then you could revisit the unity project with more familiarity.

Gaming build:

CPU: i7-7700k (5.0ghz, 1.312v)

GPU(s): Asus Strix 1080ti OC (~2063mhz)

Memory: 32GB (4x8) DDR4 G.Skill TridentZ RGB 3000mhz

Motherboard: Asus Prime z270-AR

PSU: Seasonic Prime Titanium 850W

Cooler: Custom water loop (420mm rad + 360mm rad)

Case: Be quiet! Dark base pro 900 (silver)
Primary storage: Samsung 960 evo m.2 SSD (500gb)

Secondary storage: Samsung 850 evo SSD (250gb)

 

Server build:

OS: Ubuntu server 16.04 LTS (though will probably upgrade to 17.04 for better ryzen support)

CPU: Ryzen R7 1700x

Memory: Ballistix Sport LT 16GB

Motherboard: Asrock B350 m4 pro

PSU: Corsair CX550M

Cooler: Cooler master hyper 212 evo

Storage: 2TB WD Red x1, 128gb OCZ SSD for OS

Case: HAF 932 adv

 

Link to comment
https://linustechtips.com/topic/1021287-how-to-remember-c/#findComment-12190510
Share on other sites

Link to post
Share on other sites

8 minutes ago, reniat said:

I'm only familiar with unity at a surface level, but only part of using unity is actually using C#, correct? Perhaps picking up a project that has more programming and uses C# more consistently might give you a better foundation, then you could revisit the unity project with more familiarity.

Currently, I have to tab in and out of google for references, so you reccomend that to learn it, I should use it more?

✧・゚: *✧・゚:*  Quote for a reply  *:・゚✧*:・゚✧

 

✧・゚: *✧・゚:*   Ask for discord   *:・゚✧*:・゚✧

Link to comment
https://linustechtips.com/topic/1021287-how-to-remember-c/#findComment-12190544
Share on other sites

Link to post
Share on other sites

18 minutes ago, iLostMyXbox21 said:

Inconsistently been trying for about a year, but I’ve been losing hope with it since I can’t hold onto it

That's a common thing with people who attempt to learn programming by making games. Games are hard and multidisciplinary, they are never good starting points for beginners.

 

Bob Tabors C# Fundamentals for the Absolute Beginner is a pretty good start. He's a fairly good teacher:

https://mva.microsoft.com/en-us/training-courses/c-fundamentals-for-absolute-beginners-16169?l=Lvld4EQIC_2706218949

 

As for having to look at references, it takes years of concerned effort in programming to learn something as complex as Unity or the .Net Framework. You will always be looking at references of something, no matter what level of programming you are at. That is just the nature of things.

ENCRYPTION IS NOT A CRIME

Link to comment
https://linustechtips.com/topic/1021287-how-to-remember-c/#findComment-12190553
Share on other sites

Link to post
Share on other sites

7 minutes ago, iLostMyXbox21 said:

Currently, I have to tab in and out of google for references, so you reccomend that to learn it, I should use it more?

Well first of all, using the internet as a reference is pretty standard while learning. Don't feel like you have to have EVERYTHING in your brain. I bounce between languages a lot, and sometimes I'll have to look up basic syntax for a construct in language A since I've been in language B for the last couple months. Don't feel like looking things up is bad.

 

Secondly, I definitely recommend using it more. I didn't get that "click" moment until I started doing freelance work in college, and went from just writing code for assignments and started spending hours upon hours at a time coding. Just spending time can make a huge difference. It's similar to learning an instrument or foreign language in that aspect. Sure you COULD learn german by just reading the textbook front to back, but without some practice and trying to actually use it, it's never going to be fluent.

Gaming build:

CPU: i7-7700k (5.0ghz, 1.312v)

GPU(s): Asus Strix 1080ti OC (~2063mhz)

Memory: 32GB (4x8) DDR4 G.Skill TridentZ RGB 3000mhz

Motherboard: Asus Prime z270-AR

PSU: Seasonic Prime Titanium 850W

Cooler: Custom water loop (420mm rad + 360mm rad)

Case: Be quiet! Dark base pro 900 (silver)
Primary storage: Samsung 960 evo m.2 SSD (500gb)

Secondary storage: Samsung 850 evo SSD (250gb)

 

Server build:

OS: Ubuntu server 16.04 LTS (though will probably upgrade to 17.04 for better ryzen support)

CPU: Ryzen R7 1700x

Memory: Ballistix Sport LT 16GB

Motherboard: Asrock B350 m4 pro

PSU: Corsair CX550M

Cooler: Cooler master hyper 212 evo

Storage: 2TB WD Red x1, 128gb OCZ SSD for OS

Case: HAF 932 adv

 

Link to comment
https://linustechtips.com/topic/1021287-how-to-remember-c/#findComment-12190567
Share on other sites

Link to post
Share on other sites

9 minutes ago, straight_stewie said:

That's a common thing with people who attempt to learn programming by making games. Games are hard and multidisciplinary, they are never good starting points for beginners.

 

Bob Tabors C# Fundamentals for the Absolute Beginner is a pretty good start. He's a fairly good teacher:

https://mva.microsoft.com/en-us/training-courses/c-fundamentals-for-absolute-beginners-16169?l=Lvld4EQIC_2706218949

 

As for having to look at references, it takes years of concerned effort in programming to learn something as complex as Unity or the .Net Framework. You will always be looking at references of something, no matter what level of programming you are at. That is just the nature of things.

Agree, games are probably the worst thing to do to learn a non scripting language.

When i only have a week or 2 to learn a new language i always do a simple ERP.

 

- client manager (add, edit remove)

- Items manager (add, edit, remove plus inventory)

- Items bundle (create bundles for specific time periods which are link to items you have)

- Sales/Order feature (creating an order for a client and add items or bundles that then remove them from inventory)

- Mass emailing

- Different reporting

 

This plays with datatypes, conditions, database, loops, classes hierarchy/relations and reporting.

It touches pretty much every core aspects you can see in any business.

Not necessary the tool you will work on but all company use such system.

If you want to work on a web aspect make all the data server side.

You can split the logic on another server if you want. UI can beDesktopUI/Console or HTML.

Link to comment
https://linustechtips.com/topic/1021287-how-to-remember-c/#findComment-12190618
Share on other sites

Link to post
Share on other sites

Spoiler

3E43A2CF-10CB-40F0-9206-37C7676EDFD1.thumb.jpeg.535af8a527966275875de6bba77e936c.jpeg

Best book for C# imo. Super thin but has most of the important basics. 

 

Ynity also has has its own guides to C#. 

 

I presume you know at least 1 language for programming. If not, go to codecademy & learn java. You’ll be able to translate enough to C#. Both are based on C, both are cross platform languages. C# was Microsoft’s answer to java. 

 

If you know programming, here’s what unity does special:

 Start() //executes when the object first exists in the game. 

 

Awake()//executes when the gameobject is enabled (in the inspector, there’s a checkbox that turns the object off next to its name

 

Update() //executes 1 time per frame

FixedUpdate() //60 times a second

 

monobehaviour is unity’s api. 

When you type stuff like 


GameObject

Vector3

Transform

those are all Unity functions & objects. You need to read Unity’s documentation to get it. 

 

Unity also has very comprehensive video tutorials. My favourite is survival shooter. 

Link to comment
https://linustechtips.com/topic/1021287-how-to-remember-c/#findComment-12193523
Share on other sites

Link to post
Share on other sites

1 hour ago, Lengran said:

You can programming while referring to the Unity manual or Google, it's fine and it's how I learned Unity. As a beginner you can expect that you remembered everything. After using it a lot, you will remember it naturally.

Okay thanks, so I should hook up dual monitors then? One for documentation and one for development? 

 

I normally have 2 connected anyways, but one is set to the editor and one is set to game view (for full screen testing without it covering the editor)

✧・゚: *✧・゚:*  Quote for a reply  *:・゚✧*:・゚✧

 

✧・゚: *✧・゚:*   Ask for discord   *:・゚✧*:・゚✧

Link to comment
https://linustechtips.com/topic/1021287-how-to-remember-c/#findComment-12198199
Share on other sites

Link to post
Share on other sites

52 minutes ago, iLostMyXbox21 said:

Okay thanks, so I should hook up dual monitors then? One for documentation and one for development? 

 

I normally have 2 connected anyways, but one is set to the editor and one is set to game view (for full screen testing without it covering the editor)

2 monitors makes a day/night difference when programming. Visual Studio you can also unsnap code window outside the app and dock it in any other screens.

The more screen you have the more use you will find. But 2 screens is the biggest difference you will get productivity wise. The extra are utility.

 

At work i use 3 screens but at home i'm using 6. I have 3 smaller one (~15 inches i believe) that i use 1 for notepad to take notes of things to do, 1 for performance monitor or OpenGL/DirectX (depending on what i am working on) and 1 for process explorer. My big screens i use 1 for coding, 1 for google and folder browsing and 1 for running application in it.

 

I'm pretty sure if i had 20 monitors i would find a use for each of them ?. But seriously on daily uses (non programing) i use only the 3 large monitors (mostly only the same 2) and the 3 smaller screen i have i turn them on only when i'm coding.

Link to comment
https://linustechtips.com/topic/1021287-how-to-remember-c/#findComment-12198468
Share on other sites

Link to post
Share on other sites

32 minutes ago, Franck said:

Visual Studio 

Currently, my laptop does not run VS so i use Notepad++, it doesn’t give me autocomplete optipons and it makes troubleshooting hard, but it runs so I use it

 

33 minutes ago, Franck said:

I'm pretty sure if i had 20 monitors

I’d use them all, i mostly connect a small tv to my laptop and call it dual monitors, and it works

✧・゚: *✧・゚:*  Quote for a reply  *:・゚✧*:・゚✧

 

✧・゚: *✧・゚:*   Ask for discord   *:・゚✧*:・゚✧

Link to comment
https://linustechtips.com/topic/1021287-how-to-remember-c/#findComment-12198621
Share on other sites

Link to post
Share on other sites

4 minutes ago, iLostMyXbox21 said:

Currently, my laptop does not run VS

Not enough HD space ? I mean i ran VS 2015 on my very old Dell E6400 which i bought in 2006~ish and it up to last years i was still using it when my main computer was too hot.

You can use Visual Studio code if your laptop is that old. It's much lighter.

Link to comment
https://linustechtips.com/topic/1021287-how-to-remember-c/#findComment-12198646
Share on other sites

Link to post
Share on other sites

24 minutes ago, Franck said:

Not enough HD space ? I mean i ran VS 2015 on my very old Dell E6400 which i bought in 2006~ish and it up to last years i was still using it when my main computer was too hot.

You can use Visual Studio code if your laptop is that old. It's much lighter.

No, I think it’s my CPU, it’s an old one

 

and I’ve tried VS code, but it’s slow

✧・゚: *✧・゚:*  Quote for a reply  *:・゚✧*:・゚✧

 

✧・゚: *✧・゚:*   Ask for discord   *:・゚✧*:・゚✧

Link to comment
https://linustechtips.com/topic/1021287-how-to-remember-c/#findComment-12198764
Share on other sites

Link to post
Share on other sites

2 minutes ago, iLostMyXbox21 said:

No, I think it’s my CPU, it’s an old one

 

and I’ve tried VS code, but it’s slow

You will have to upgrade if you ever want to touch unity. My laptop was too slow for Unity but not for Visual Studio. For sure you wont  be able to run it.

I upgraded in early 2018 with a very cheap Ryzen 3 Dell laptop and it run Visual Studio, Unity, Xenko flawlessly and it was 440$ USD during their special which was available at launch. Note that laptop is really only a secondary tools for me so i don't need extreme power and i am not gaming with it.

Link to comment
https://linustechtips.com/topic/1021287-how-to-remember-c/#findComment-12198808
Share on other sites

Link to post
Share on other sites

8 minutes ago, Franck said:

You will have to upgrade if you ever want to touch unity. My laptop was too slow for Unity but not for Visual Studio. For sure you wont  be able to run it.

I can run it fine, all the things I work on reach about 30 FPS with everything on (graphics wise) but VS will start and then when I try to open something or start a project, it says it isn’t responding and it freezes up my laptop and I have to unplug it (battery doesn’t work so it turns off immediately) and turn it back on to get it to work again, so I just uninstalled it and started using notepad++

 

11 minutes ago, Franck said:

I upgraded in early 2018 with a very cheap Ryzen 3 Dell laptop and it run Visual Studio, Unity, Xenko flawlessly and it was 440$ USD during their special which was available at launch. Note that laptop is really only a secondary tools for me so i don't need extreme power and i am not gaming with it.

Well when I upgrade it’s gonna be to a pc and not another laptop lol

✧・゚: *✧・゚:*  Quote for a reply  *:・゚✧*:・゚✧

 

✧・゚: *✧・゚:*   Ask for discord   *:・゚✧*:・゚✧

Link to comment
https://linustechtips.com/topic/1021287-how-to-remember-c/#findComment-12198870
Share on other sites

Link to post
Share on other sites

2 hours ago, iLostMyXbox21 said:

Okay thanks, so I should hook up dual monitors then? One for documentation and one for development? 

Bear in mind that you may want a monitor that can be used in portrait mode instead of landscape mode. For usability you should probably be able to switch between them quickly. When you're working on longer projects, you'll want the longer monitor. You can get much more text on the screen.

ENCRYPTION IS NOT A CRIME

Link to comment
https://linustechtips.com/topic/1021287-how-to-remember-c/#findComment-12198903
Share on other sites

Link to post
Share on other sites

1 minute ago, straight_stewie said:

Bear in mind that you may want a monitor that can be used in portrait mode instead of landscape mode. For usability you should probably be able to switch between them quickly. When you're working on longer projects, you'll want the longer monitor. You can get much more text on the screen.

I normally try not to have too much on one script to make troubleshooting much easier, I will mostly make 1 script for each thing, like 1 for movement (includes looking) 1 for attacking, 1 for something else, 1 for HUD

✧・゚: *✧・゚:*  Quote for a reply  *:・゚✧*:・゚✧

 

✧・゚: *✧・゚:*   Ask for discord   *:・゚✧*:・゚✧

Link to comment
https://linustechtips.com/topic/1021287-how-to-remember-c/#findComment-12198913
Share on other sites

Link to post
Share on other sites

2 hours ago, iLostMyXbox21 said:

I normally try not to have too much on one script to make troubleshooting much easier, I will mostly make 1 script for each thing, like 1 for movement (includes looking) 1 for attacking, 1 for something else, 1 for HUD

Good way of thinking and you shouldn't have long methods either. If you have method longer than 20 lines which fits on 720p monitor then 99% chances that you are likely breaking the open-closed principle or the single responsibility principle. Everything should always fit into a single landscape mode with any screen built after Year2K bug ?

 

I am not saying not following OCP or SRP is super bad. It's just makes things much clearer and easier to troubleshoot if you follow them. Especially working with large codebase.

Link to comment
https://linustechtips.com/topic/1021287-how-to-remember-c/#findComment-12199447
Share on other sites

Link to post
Share on other sites

Just now, Franck said:

Good way of thinking and you shouldn't have long methods either. If you have method longer than 20 lines which fits on 720p monitor then 99% chances that you are likely breaking the open-closed principle or the single responsibility principle. Everything should always fit into a single landscape mode with any screen built after Year2K bug ?

 

I am not saying not following OCP or SRP are bad. It's just makes things much clearer and easier to troubleshoot. Especially working with large codebase.

Yeah I do it for the troubleshooting, and I am OCD when it comes to my files, so I’ll have folders with sub folders that have sub folders and then I’ll organize them, Also I find it harder to read long scripts, so I’ll keep them as short as possible and I’ll use Tab a lot to make it look pretty, everyone who sees my file explorer says I have OCD because everything is organized

✧・゚: *✧・゚:*  Quote for a reply  *:・゚✧*:・゚✧

 

✧・゚: *✧・゚:*   Ask for discord   *:・゚✧*:・゚✧

Link to comment
https://linustechtips.com/topic/1021287-how-to-remember-c/#findComment-12199457
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×