Reddit » C# programming language
2,341 FOLLOWERS
Reddit is a network of communities based on people's interests. All about the object-oriented programming language C# can be found in the subreddit. Come and discuss your side projects with others, ask for advice and reviews. Ask for help with programming and share or exchange your C# skills.
Reddit » C# programming language
2h ago
I have an async method that is calling a number of other methods - some async, some not. Average total execution time is about 45-50 seconds. The method takes a string as an input parameter.
What I’m ultimately trying/hoping to do is take an array/list of strings, start the async method on the entire array/list more or less at once, and get back continuous status updates from the method for each invocation so I can populate a DataGridView kinda like
Items
Status
Item1
Started submethod 3
Item2
Complete
Item3
Error returned: blah
Item4
Started submethod 5
A friend who I bother ..read more
Reddit » C# programming language
2h ago
I have a parent abstract class:
public abstract class PlayerWeapon : MonoBehaviour{
float range;
int damage;
int ammo;
}
And a child class:
public class PlayerPistol : PlayerWeapon{
float range = 10f;
int damage = 3;
int ammo = 12;
}
However, I can't do anything like this.range = 10f; inside of PlayerPistol
How can I make it so each child class of PlayerWeapon can modify the fields range, damage and ammo with values specific to the weapon type (e.g. Pistol)
I want to try to avoid using properties as I find them a bit "precocious" and overly formal
Thank you
submitted by /u/aspiringgamecode ..read more
Reddit » C# programming language
2h ago
https://preview.redd.it/iewpinpdf6rc1.png?width=979&format=png&auto=webp&s=f739989769889526a0762e4460745d12937d23b7
https://preview.redd.it/vv8rai4ef6rc1.png?width=2044&format=png&auto=webp&s=29e808c507edc8bd9d26a67d3daaab01d4fd90ff
submitted by /u/VinvinVR
[visit reddit] [comments ..read more
Reddit » C# programming language
2h ago
I am using as C# script to parse arguments from a custom protocol handler to open files ...
var url = WebUtility.UrlDecode(args[0]); var processInfo = new ProcessStartInfo { FileName = url.Substring(url.IndexOf("://") + 3).Trim('/'), UseShellExecute = true };
... this works fine, but I actually don't want to see the shell window itself unless there is an issue with th e url path. So I need UseShellExecute set to be true which overwrites all things I tried to hide the window. Is there a way to achieve what I want?
I have also tried this with a python script where I easily can achieve what I ..read more
Reddit » C# programming language
2h ago
I’m making a flappy bird 2d game on unity and i’m trying to add clouds in the background, but it’s giving me this error, and I don’t know what to do, i’m super beginner at coding. i left ss of my coding, just press the picture.
submitted by /u/makeouthill64
[visit reddit] [comments ..read more
Reddit » C# programming language
2h ago
New to Csharp, I am making a VR game and I keep getting this error in unty. How do I fix this?
https://preview.redd.it/wfytna6p85rc1.png?width=953&format=png&auto=webp&s=0132b4221fb976dd698cf9a2f584a07e78f69c59
https://preview.redd.it/5m4ukb6p85rc1.png?width=1075&format=png&auto=webp&s=157f3e3fcb86b56494baf283e2cb629a0527a7c5
submitted by /u/VinvinVR
[visit reddit] [comments ..read more
Reddit » C# programming language
2h ago
https://preview.redd.it/4tslprskx4rc1.png?width=1566&format=png&auto=webp&s=4637d18024b4671a4e6c2cbb5f8a79cbd8bed31f
I have this 'System.NullReferenceException: 'Object reference not set to an instance of an object' when I click on save in the Edit.cshtml page. My Edit Page displays all the dropdown menus with their data, but I don't understand why I have this problem. Here are my codes:
// GET: Employees/Edit/5
public async Task<IActionResult> Edit(int? id)
{
if (id == null)
{
return NotFound();
}
// Fetch the employee including related entities like Department, Grade ..read more
Reddit » C# programming language
14h ago
Hey everyone. long story short I've self taught html/css, vanilla Javascript for the frontend and some React, then came across A course by neil cummings that is meant for beginners in which he says you need SOME coding experience ( like being at level one on a scale of 0 to 10 ) so I bought immediately given I've built some basic, shitty apps via javascript and React and I DO WANT to become a C#/Dotnet developer since it's by far the most in demand skill for web development in my country,
now, I skipped the rest of that prerequisite video and apparently, I need to know sth like what a C# cl ..read more
Reddit » C# programming language
14h ago
Hi All,
For a side project, I want to create a console application that looks like the old Turbo Pascal IDE.
I'm pretty experienced, but what I can't think how to do is create a message pump without maxing out the processor.
As I want it cross platform, I can't rely on win 32 calls.
Is something like this sensible?
while (true) { // Monitor keyboard and mouse // If something's changed, dispatch message Thread.Sleep(0); }
Thanks in advance.
submitted by /u/MagazineOk5435
[visit reddit] [comments ..read more
Reddit » C# programming language
14h ago
I am learning Events in C# currently. Till now, I have understood that publisher class objects raise an event and then subscriber class objects respond. Subscriber classes contain Event Handler methods to achieve this.
I was watching a Unity Game Engine video, where the guy defined an Event Handler method in the publisher class itself i.e., the same class was both a publisher and a subscriber. Is this allowed in normal C#? Or is it specific to Unity?
OnSpacePressed is the Event and Testing_OnSpacePressed is the Event Handler. Both are inside the same class named Testing Events.
submitted ..read more