C
C#2w ago
Frite

how can I avoid chaos like this ?

No description
12 Replies
Keswiik
Keswiik2w ago
For starters, what are you trying to do? Because you could just check Keyboard.GetState().IsKeyDown(...) instead of trying to make a bunch of properties
Frite
Frite2w ago
but what if i want proprerties ?
Saber
Saber2w ago
Then deal with the mess
Pobiega
Pobiega2w ago
at least capitalize them, and use the => expression syntax
Frite
Frite2w ago
No description
Shawn
Shawn2w ago
Why do you want properties?
Frite
Frite2w ago
to turn this into this
No description
Somgör from Human Resources
But why :pwetty: Seems like lots of extra work for very little payoff
Frite
Frite2w ago
i had enouth of copy+past i will allways keep it when i code
kurumi
kurumi2w ago
don't forget other snippets included: multiple functions to change console colors (aka Console.SetRed() / Blue / Green / etc), get all processes in OS (aka Processes.Google / notepad / vscode / etc). it is super useless at least you can create extension method to avoid this boilerplate code or write custom SG
Angius
Angius7d ago
public bool IsKey(Key k)
=> Keyboard.GetState().IsKeyDown(k);
public bool IsKey(Key k)
=> Keyboard.GetState().IsKeyDown(k);
if (IsKey(Key.A))
{

}
if (IsKey(Key.A))
{

}
Shorter, but no boilerplate
Want results from more Discord servers?
Add your server
More Posts
i want to migrate db from sqlserver to supabase(postressql) but i have error with entitity frameworki want to migrate db from sqlserver to supabase(postressql) but i have error with entitity frameworknew to c#! not too sure why i can't call my method from classhello! very much new to C# and i've been trying out on how to use constructors in a new class and i Test project in project where project is in same folder as solution (codecrafters.io)I am going through codecrafters.io DNS server with C#. The barebones project you get looks like thUnsure how to set IIS Application Pool Identity to non-admin user or semi-admin userSo I have an ASP.NET project that I am working on where the web page will be hosted inside of IIS. FStep up my programming levelHello I’m currently finished like a classic C sharp course like I know some oop some data structure How to check if program is running as root on LinuxI need my program to be run as sudo to function, so I want to exit if it's not. How can I check if tthumbnail gen(doc, excel)Here again but now I need to generate doc and excel files thumbnails for free for business.problem with updating method for backend with mongo driverI have backend with kinda nested values and I'm trying to add methods. with these code I can update UseStaticFiles for HTMLI have generated a Static WebApp from my Markdown Files. ```c# app.UseStaticFiles(new StaticFileOptTrouble connecting to MySQL database form a seperate computerI'm learning C# by making my own Chat app. And I want to use a database (MySQL) for storing username