mtreit
mtreit
CC#
Created by Vortac on 3/11/2025 in #help
IDisposable Constructor Injection
And you would probably remove the other using (the first line of your code example) because you don't want two pieces of code disposing the same thing possibly at different times.
4 replies
CC#
Created by Vortac on 3/11/2025 in #help
IDisposable Constructor Injection
If the class stores the injected thing in a field and effectively takes ownership of that disposable, then yes it should implement IDisposable itself.
4 replies
CC#
Created by David_Bones on 3/10/2025 in #help
How to interpret C#/.NET documentation
I use Bing for search pretty much exclusively and the results in my experience have only gotten better over time.
45 replies
CC#
Created by David_Bones on 3/10/2025 in #help
How to interpret C#/.NET documentation
Old school programmers were working under much more constrained environments. The amount of things available to know was also a lot smaller. It's hard to compare programming from 25+ years ago to today.
45 replies
CC#
Created by David_Bones on 3/10/2025 in #help
How to interpret C#/.NET documentation
C# In Depth is excellent. Also not a beginners book however.
45 replies
CC#
Created by David_Bones on 3/10/2025 in #help
How to interpret C#/.NET documentation
I'd buy a print copy 😉
45 replies
CC#
Created by David_Bones on 3/10/2025 in #help
How to interpret C#/.NET documentation
CLR via C# is a great book but it's definitely not remotely for beginners 🙂 Also a bit dated now.
45 replies
CC#
Created by David_Bones on 3/10/2025 in #help
How to interpret C#/.NET documentation
On modern hardware you almost never want linked lists over more cache-friendly data structures.
45 replies
CC#
Created by David_Bones on 3/10/2025 in #help
How to interpret C#/.NET documentation
Nobody uses LinkedList<T> in .NET programming 😄
45 replies
CC#
Created by David_Bones on 3/10/2025 in #help
How to interpret C#/.NET documentation
I can't believe that generic article uses LinkedList<string> as an example.
45 replies
CC#
Created by David_Bones on 3/10/2025 in #help
How to interpret C#/.NET documentation
You don't have to do OOP. I write lots of C# code and very little of it is what I would consider object oriented.
45 replies
CC#
Created by David_Bones on 3/10/2025 in #help
How to interpret C#/.NET documentation
Beware of stack overflow. It often has all sorts of bad information.
45 replies
CC#
Created by kyeede on 2/26/2025 in #help
✅ MySQL Database Procedure Problem
In your stored procedure? Sure.
47 replies
CC#
Created by kyeede on 2/26/2025 in #help
✅ MySQL Database Procedure Problem
And you can break that code up into more methods like:
AddParametersForChannel(int guildId, int channelId, string channelName, string allowedMembersJson, SqlCommand command);
AddParametersForChannel(int guildId, int channelId, string channelName, string allowedMembersJson, SqlCommand command);
47 replies
CC#
Created by kyeede on 2/26/2025 in #help
✅ MySQL Database Procedure Problem
Yes it would 🙂
47 replies
CC#
Created by kyeede on 2/26/2025 in #help
✅ MySQL Database Procedure Problem
spCreateChannel spCreateRole
47 replies
CC#
Created by kyeede on 2/26/2025 in #help
✅ MySQL Database Procedure Problem
Why don't you have separate sprocs for creating roles vs. creating channels?
47 replies
CC#
Created by kyeede on 2/26/2025 in #help
✅ MySQL Database Procedure Problem
Sure, I just stuck that in as pseudo-code, you don't necessarily need to make a method for that - although it usually is cleaner and easy to read if you make small methods and chain them together in your overall flow.
47 replies
CC#
Created by kyeede on 2/26/2025 in #help
✅ MySQL Database Procedure Problem
Are you actually intending to create multiple guilds?
47 replies
CC#
Created by kyeede on 2/26/2025 in #help
✅ MySQL Database Procedure Problem
You probably want something like:
foreach (var channel in channels)
{
foreach (var role in roles)
{
using var cmd = GetSqlCommandForGuildCreationSproc();
// Fill out all of the parameters for the call to create the guild

// Now execute it
cmd.ExecuteNonQuery(); // Or whatever if it returns data
}
}
foreach (var channel in channels)
{
foreach (var role in roles)
{
using var cmd = GetSqlCommandForGuildCreationSproc();
// Fill out all of the parameters for the call to create the guild

// Now execute it
cmd.ExecuteNonQuery(); // Or whatever if it returns data
}
}
47 replies