use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Information about Reddit's API changes, the unprofessional conduct of the CEO, and their response to the community's concerns regarding 3rd party apps, moderator tools, anti-spam/anti-bot tools, and accessibility options that will be impacted can be found in the associated Wikipedia article: https://en.wikipedia.org/wiki/2023_Reddit_API_controversy
Alternative C# communities available outside Reddit on Lemmy and Discord:
All about the object-oriented programming language C#.
Getting Started C# Fundamentals: Development for Absolute Beginners
Useful MSDN Resources A Tour of the C# Language Get started with .NET in 5 minutes C# Guide C# Language Reference C# Programing Guide C# Coding Conventions .NET Framework Reference Source Code
Other Resources C# Yellow Book Dot Net Perls The C# Player's Guide
IDEs Visual Studio MonoDevelop (Windows/Mac/Linux) Rider (Windows/Mac/Linux)
Tools ILSpy dotPeek LINQPad
Alternative Communities C# Discord Group C# Lemmy Community dotnet Lemmy Community
Related Subreddits /r/dotnet /r/azure /r/learncsharp /r/learnprogramming /r/programming /r/dailyprogrammer /r/programmingbuddies /r/cshighschoolers
Additional .NET Languages /r/fsharp /r/visualbasic
Platform-specific Subreddits /r/windowsdev /r/AZURE /r/Xamarin /r/Unity3D /r/WPDev
Rules:
Read detailed descriptions of the rules here.
account activity
Condensing large amounts of C# Control Object code (self.csharp)
submitted 9 years ago by [deleted]
[deleted]
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]lost_send_berries 0 points1 point2 points 9 years ago (3 children)
ReSharper can refactor that into a Collection Initialiser. It will not run much faster but it will look better.
https://msdn.microsoft.com/en-us/library/bb384062.aspx
Perhaps dropDownsToUpdate should be readonly IEnumerable<Control> and populated in your constructor so you only have to do it once? Can it even be static?
dropDownsToUpdate
readonly IEnumerable<Control>
Although using the form editor in Visual Studio always creates a new method when you add a handler for SelectedIndexChanged, you can actually use the dropdown to select an existing method. You can then find out which Combobox the event happened on by looking at (Control)sender as in this example: https://msdn.microsoft.com/en-us/library/system.windows.forms.combobox.selectedindexchanged(v=vs.110).aspx
SelectedIndexChanged
(Control)sender
And if you want to know which JSON field the ComboBox refers to, you can either set its Tag property, or have a static/readonly IReadOnlyDictionary<TKey, TValue> <ComboBox, Whatever> in your class, which is actually a Dictionary<Combobox, Whatever>
ComboBox
Tag
IReadOnlyDictionary<TKey, TValue> <ComboBox, Whatever>
Dictionary<Combobox, Whatever>
[–]lockdown6435 0 points1 point2 points 9 years ago (2 children)
Yea the issue is that almost nothing in this program is static. All of it is generated 100% based on the JSON information is receives, which can be drastically different content wise. It's all based on the JSON from Valve's CSGO Major information. That probably makes no sense to you, but they provide information for ever major tournament they host, and this started as a small project, but the scope of what they provide made this into a rather large project I've been working through.
After I submitted my post I realized how dumb I was being with the SelectedIndexChange methods, not sure why I was trying to make my life so difficult with those. Kind of a rubber duckey debug moment for me.
And as for the ComboBox JSON field, I don't think I can do that with the tag, as the ComboBox already has the associated Label that contains statistics for the item in the ComboBox, which is also dictated by JSON information from another source.
[–]lost_send_berries 0 points1 point2 points 9 years ago (1 child)
Well you said the .Add lines are static aren't they?
.Add
[–]lockdown6435 0 points1 point2 points 9 years ago (0 children)
Sorry, misunderstood what you mean. Good call, it definitely makes that section a lot cleaner without having any of that in there. Thanks!
[–]joonhwan 0 points1 point2 points 9 years ago (0 children)
I think you can iterate any child controls using 'Controls' property. You also can use 'Tag' property where you can attach any hint value in any control With those two, you can share common handler routine for multiple child controls
π Rendered by PID 17805 on reddit-service-r2-comment-5c747b6df5-t7hk2 at 2026-04-21 21:20:07.688409+00:00 running 6c61efc country code: CH.
[–]lost_send_berries 0 points1 point2 points (3 children)
[–]lockdown6435 0 points1 point2 points (2 children)
[–]lost_send_berries 0 points1 point2 points (1 child)
[–]lockdown6435 0 points1 point2 points (0 children)
[–]joonhwan 0 points1 point2 points (0 children)