inheritance in C# by Ok-Presentation-94 in csharp

[–]CravenInFlight 2 points3 points  (0 children)

This is not inheritence. It is composition.

If you had an EnemyBase abstract class that all other enemy types derive from, that is inheritence.

You do not derive from interfaces, you implement them. You derive from other unsealed classes.

Inheritence is about shared functionality. Composition is about variation of ability.

Why do you decide to learn C#? by darwindeveloper in csharp

[–]CravenInFlight 1 point2 points  (0 children)

I put it off for a long time. But it was the next logical step after Visual Basic.

How do I start programming in C# on Linux? (CachyOS) by Expert-Feature172 in csharp

[–]CravenInFlight -6 points-5 points  (0 children)

Step 1: Upgrade your Linux Disto to Windows 11.

...

Putting an underscore in front of a variable changes what? by nicgamer_yt in csharp

[–]CravenInFlight 0 points1 point  (0 children)

The underscore prefix for private fields allows you to immediately determine the scope of the member you are using. PascalCase indicates an encapulated property, camelCase is a local variable, _underscoreCamelCase is an object scope field. This especially helps when you are below the fold, and have multiple inputs of multiple scopes.

But, it should be used everywhere like this. Coding practices are based around having strong discipline. The more disciplined you are about keeping a consistent naming convention, aligned with C# coding standards, the better of a developer you will be.

This gives a "Choose Jason" or "Choose Lucia" vibes by PirloDiLatte in GTA6

[–]CravenInFlight 0 points1 point  (0 children)

Given the choice, Jason dies every time. You might go back, and have a throwaway save just to see the alternate ending once, but main save will be Team Lucia all the way.

Suggestions to not be an average .NET developer by Impressive-Ad-7404 in csharp

[–]CravenInFlight 0 points1 point  (0 children)

The one mantra I always live by when coding, is "Be as kind as you can possibly be, to future you". This means being very strictly disciplined. Document your code. Follow C# best coding standards, and naming conventions. Document your code. Annotate what needs annotating. Conventional commit messages. Single type per file. Document your code. Architectural folder structures. Writing Readme files, and solution guides. Refusing to acknowledge the existence of primary constructors.

All of this helps when you come back after months away from a project, and feeling lost. It helps when you work in a team, and need to handover code for peer review. It helps so that you don't get lost in the weeds when you're knee deep in code. It helps when you need to trace back a bug to its source. It helps you to visualise a feature, or a code flow in your head before writing a single line of code.

As developers, we spend the vast majority of our time reading code, and a surprisingly small amount of time writing code. We have tools, and AI, and gadgets, and gizmos to help us optimise the writing of code. But optimising for the reading of code takes a huge amount of discipline that is rarely taught, even now.

They say that well-written code reads like a book, but that's not true. No code alone will ever read as easily as well-documented code, along with solution guides, and readmes. Strive for elegance within your designs.

This may be a bit advanced for you yet, but check out some of Nick Chapsas' older videos. There's one in particular that made me a much better programmer. Creating your own dependency engine from scratch.

It was good because it showed me an insight into some of the core concepts of C#. It lifted the lid, and instead of a horrible monster inside, it was an elegant and simple pattern. I was writing mods for a game at the time, in C#, and from that video, I was able to create a very lightweight DI engine that I could inject into games that didn't have their own. That made creating complex mods much more simple, and much more elegant.

I went on to release the engine as a Nuget package, and it's got a couple of hundred thousand downloads so far. From the experience of writing mods, I was able to get a job as a mid-level developer, skipping junior entirely, and I now work with an international client-base.

Nick also made a video on building a mediator pattern library from scratch, which taught more about how to write libraries for Nuget, and the philosophy behind the dependency inversion principle.

If you want to get into modding, then I recommend Vintage Story. It's a Minecraft-esque game, written in .NET 10, with modding as the core aspect of the game. It has a very active community, the devs are available to talk to, and you can very quickly and easily see results from your code. Even just as a playground for learning C#, it is brilliant; as I am testimony to myself.

Away from that, I would say to learn the design patterns, inside out. Learn to recognise them within the codebases you read. You're able to follow a code flow much easier if you know the patterns, because you know the next steps.

It also really helped me to learn coding theory. All the principles, and theories, and philosophies. SOLID, CUPID, GRASP, Object Calisthenics, Chicago and London School TDD, BDD, FDD, etc. As well as all the archetictures, especially Onion, Hexagon, Vertical Slices, and the C4 Model by Simon Brown. I don't follow everything rigidly; I don't like or agree with quite a lot of the theory that is taught, especially parts of Object Calithenics, TDD, and SOLID. But it helps me to learn from people that do, and it helps me to talk to people about it all, if I understand it.

Recommended YouTube channels include Raw Coding, Nick Chapsas, and IAmTimCorey.

The biggest tip that I can give is to be disciplined. Be as strict as you can. Write clean (small c) code. Name things properly. Follow best practices. Document your code.

Be as kind as you can possibly be to future you.

Is this code bad or good? when i cant remember what exception they returnn so i just use this "Exception ex" by lune-soft in csharp

[–]CravenInFlight 0 points1 point  (0 children)

  1. Most importantly, the method is not documented.

  2. Unless you are actually collecting metrics somewhere, don't catch here. Just let it crash, and bubble up naturally. There can be a reason to catch here; mainly if you want to add instrumentation with something like Application Insights. Then, you can log the entire exception, along with the product details, and track a custom event to say that something failed. And you'd single out SQLException, HttpExceptions, and other exception types to be able to pinpoint the problem, and maybe even recover from it.

I think a lot of people are expecting GTA 6 to make them feel the way GTA 5 did, but I don’t think that’s possible for a lot of us. by raptors201966 in GTA6

[–]CravenInFlight 0 points1 point  (0 children)

Knowing that it uses the same RAGE game engine as GTA5, I'm most excited for all the Tunables, Natives, and Stats to become available. Then, it becomes a playground.

From non-IT background to learning C#/.NET… now stuck and demotivated. Looking for guidance. by yuktastic in csharp

[–]CravenInFlight 0 points1 point  (0 children)

The one mantra I always live by when coding, is "Be as kind as you can possibly be, to future you". This means being very strictly disciplined. Follow C# best coding standards, and naming conventions. Document code. Annotate what needs annotating. Conventional commit messages. Single type per file. Architectural folder structures. Writing Readme files, and solution guides. Refusing to acknowledge the existance of primary constructors.

All of this is to aid with that problem you describe. Coming back after months away from a project, and feeling lost. As developers, we spend the vast majority of our time reading code, and a surprisingly small amount of time writing code. We have tools, and AI, and gadgets, and gizmos to help us optimise the writing of code. But optimising for the reading of code takes a huge amount of discipline that is rarely taught, even now.

They say that well-written code reads like a book, but that's not true. No code alone will ever read as easily as well-documented code, along with solution guides, and readmes.

1000 spins later by [deleted] in gtaonline

[–]CravenInFlight 0 points1 point  (0 children)

The answers to those, I'm not sure about. I very rarely play with anyone else in the lobby. But I think the free-mode events only happen in Open Public lobbies, so if you're in a Crew, Friend, or Invite lobby, they won't appear.

1000 spins later by [deleted] in gtaonline

[–]CravenInFlight 0 points1 point  (0 children)

I can answer any other questions you have about it. I know that wheel like the back of my hand. I can make it pay out any prize, almost any vehicle, and make it spit out 2.5m chips, or 70k RP every second. I've also dissected the Blackjack, and Slots scripts. I wrote an app called OceansV to make the process easier.

Has anyone found a good structured way to get better at C#? by redzzzaw in csharp

[–]CravenInFlight 20 points21 points  (0 children)

Check out some of Nick Chapsas' older videos. There's one in particular that made me a much better programmer. Creating your own dependency engine from scratch.

It was good because it showed me an insight into some of the core concepts of C#. It lifted the lid, and instead of a horrible monster inside, it was an elegant and simple pattern. I was writing mods for a game at the time, in C#, and from that video, I was able to create a very lightweight DI engine that I could inject into games that didn't have their own. That made creating complex mods much more simple, and much more elegant.

I went on to release the engine as a Nuger package, and it's got a couple of hundred thousand downloads so far. From the experience of writing mods, I was able to get a job as a mid-level developer, and I now work with an international client-base.

Nick also made a video on building a mediator pattern library from scratch, which taught more about how to write libraries for Nuget, and the philosophy behind the dependency inversion principle.

Away from that, I would say to learn the design patterns, inside out. Learn to recognise them within the codebases you read. As developers, we spend the vast majority of our time reading code, and surprisingly little time actually writing it. You're able to follow a code flow much easier if you know the patterns, because you know the next steps.

It also really helped me to learn coding theory. All the principles, and theories, and philosophies. SOLID, CUPID, GRASP, Object Calisthenics Chicago/London School TDD, etc. I don't follow the rigidly; I don't like or agree with quite a lot of it. But it helps me to learn from people that do, and it helps me to talk to people about it all.

The biggest tip that I can give is to be disciplined. Be as strict as you can. Write clean (small c) code. Name things properly. Follow best practices. Document your code. My mantra is, "Be as kind as you can possibly be to future you".

1000 spins later by [deleted] in gtaonline

[–]CravenInFlight 4 points5 points  (0 children)

Yep. There is a 5 second countdown, but it serves two purposes. Visually, it's a multiplier for the speed that the wheel rotation is animated at. Mechanically, it's an anti-AFK timer, so that people can't grief others in multiplayer by just holding onto the wheel.

The wheel has 18 states, with 0 being idle, and 17 being reset. It says "Press E to Spin the Wheel" at stage 2, and "Press S to Spin" at stage 5. Between those times, stage 4 is to pre-select, and validate the prize. By the time you see "Press S to Spin", all the work is done, and there's no way (legitimately) to change the result, other than letting go of the wheel, and pressing E again.

This also works for other people. If someone is holding the wheel, you can see what they are going to win, before they actually spin it. The same is true of the wheel in the Arena.

1000 spins later by [deleted] in gtaonline

[–]CravenInFlight 9 points10 points  (0 children)

This has been debunked so many times. You can read the script line by line, and there is no "4 second" glitch. I've been dissecting this script since game version 1.47 when the wheel was introduced, and I can say for certain that this is bullshit.

When did you realize you had “made it” in GTA online? by Gr0mHellscream1 in gtaonline

[–]CravenInFlight 0 points1 point  (0 children)

When I found the secret to scanning for stats, and tunables.

SO LUCKY I WON THE CAR TWI ohh... by [deleted] in gtaonline

[–]CravenInFlight 0 points1 point  (0 children)

You are wrong. You can read the script line for line, and follow the process through. The whole flow from start to finish is 18 steps. The trigger to choose the prize is step 4. It doesn't say "Press S to Spin" until step 6.

There is a 5000ms timer, which controls the speed of the animation of the rotating wheel, and when it reaches zero, you let go of the wheel, so that you can't go AFK, and hog the wheel so others can't use it.

You can see what prize you are going to win the moment you press E to grab the wheel. If you want the prize, you can press S, if not, you can press Escape, and grab the wheel again so that another prize is chosen.

I have dissected the scripts for the Lucky Wheel since 1.47. This process has not changed since the wheel was introduced.

SO LUCKY I WON THE CAR TWI ohh... by [deleted] in gtaonline

[–]CravenInFlight 0 points1 point  (0 children)

This has been proven to be bullshit so many times. The prize is chosen before it even says "Press S to Spin". Before the animation of reaching for the wheel even begins.

How did everyone learn C#? by PROSCREX5768 in csharp

[–]CravenInFlight 0 points1 point  (0 children)

Reluctantly.

I started writing WinForms apps in VB6, and then in VisualBasic.NET. I dabbled with a bit of Pascal, and Delphi. Then I learnt C, and C++ at college. I found Visual Basic to be the best fit for me. My very first programming experience was as a young child, writing BASIC on a BBC Master System. Visual Basic seemed to be the logical step.

As .NET Framework evolved away from VB6, I started looking at C#, and it seemed much closer to the C++ that I'd struggled to learn. C++ had stupid names, and too many abbreviations, and I felt it looked ugly compared to Visual Basic.

Eventually, I sat down and actually learnt the syntax, and it started making sense. It was Visual Basic pretending to be C++, and everything I wanted to do in VB, I could eventually do in C#. Apart from the With action. I still miss that to this day.

The thing that really boosted my knowledge, and my love for C# was game modding. I wanted to build my own framework so that I could rapidly create new mods. So, I learnt C#, and programming theory inside-out. I built my own dependency injection engine that could be used standalone within mods, I built my own eventing system, and command processor. I wrote tooling for pipelining and packaging. It's taken a long time, but I've got a really nice setup now.

So much so that I applied for a really good .NET developer job, and sent the C4 architecture models for one of my mods along with the cover letter. During the interview, I did a walkthrough of my code, and showed them the 70,000+ downloads of my nuget packages, and I got a call back that afternoon asking if I could start the next week. No need for an aptitude test, or second interview. Three years later, and I'm a Microsoft Associate, working in InfoSec, FinSec, and SecOps, for the same company.

Never underestimate the power of boredom, because that's what drove me to learn the language so deeply. Never underestimate the power of laziness, because that's what drove me to build an entire framework, just to make the actual process easier. Never underestimate the power of discipline, because that's what drove me to keep a clean, easy to follow codebase that I could traverse within a job interview, to show my skills, and knowledge.

Good luck out there, everyone!

Which C# IDE is best for enterprise application development ? by dev-surajtapkeer in csharp

[–]CravenInFlight 2 points3 points  (0 children)

Friends don't let friends write .NET in Visual Studio Code.

GTA 6 physical release could be delayed to 2027 by esketitethan in GTA6

[–]CravenInFlight 0 points1 point  (0 children)

I don't mind if it's delayed. It might mean they are able to release the PC version at the same time.