IsNotNull
IsNotNull
CC#
Created by hdmark on 11/20/2024 in #help
Asp.net (.net461, global.asax)
What are you referring to when you say 'specify output'. That is not something I do when debugging from a project that has a sln + csproj file
4 replies
CC#
Created by hdmark on 11/20/2024 in #help
Asp.net (.net461, global.asax)
Output folder? Does your project not have solution or project files?
4 replies
CC#
Created by IsNotNull on 9/11/2024 in #help
Hangfire Execution Time
Its really odd that a library that schedules execution times can't supply the scheduled time at execution. Thanks for the info @ded
5 replies
CC#
Created by Ploot on 9/1/2024 in #help
✅ Per request timeout
https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httpclient.timeout?view=net-8.0#remarks
6 replies
CC#
Created by Ploot on 9/1/2024 in #help
✅ Per request timeout
No description
6 replies
CC#
Created by Cyro on 8/28/2024 in #help
How does one typically handle complex program flow?
In a larger commerce system I worked on in the past, we had sales orders that when processed had hundreds of conditions and state changes. We eventually had a whole namespace filled with classes that would process various aspects of the order and validate business logic. If we tried to build a system like that using only a single state machine, it would have become difficult or impossible to maintain after the first couple months of development.
45 replies
CC#
Created by Cyro on 8/28/2024 in #help
How does one typically handle complex program flow?
You don't have to go to such lengths if you don't need to, but over time separating responsibilities into (somewhat) narrowly named classes can make it easier to find and modify code.
45 replies
CC#
Created by Cyro on 8/28/2024 in #help
How does one typically handle complex program flow?
For example, within the .NET base classes, it would be typical for a key provider, a file provider, a script runner, and a remote connection to all be modeled as separate classes that would each maintain their own state and logic related to operations.
45 replies
CC#
Created by Cyro on 8/28/2024 in #help
How does one typically handle complex program flow?
@Cyro you mentioned a state machine, are you avoiding OOP compositional approaches for some reason?
45 replies
CC#
Created by IsNotNull on 7/11/2024 in #help
More Elegant Way to Make a Generic Lookup Type
That would be a good idea, and is similar to how I plan to consume these types in my own projects. The types though, are in an open source library and I want the library to remain neutral about configuration and dependency choices of the consumer. I won't pressume they are using a specific (or any) DI container.
15 replies
CC#
Created by IsNotNull on 7/11/2024 in #help
More Elegant Way to Make a Generic Lookup Type
These changes will look great on my benchmarks 😆
15 replies
CC#
Created by IsNotNull on 7/11/2024 in #help
More Elegant Way to Make a Generic Lookup Type
The lookup type implements a non allocating StartsWith search, and right now to get around the issues of this help post I'm using LINQ to cast the IEnumerable (which boxes the struct enumerator, killing the performance benefit of making the enumerator non-allocating).
15 replies
CC#
Created by IsNotNull on 7/11/2024 in #help
More Elegant Way to Make a Generic Lookup Type
@boiled goose thanks for the link
15 replies
CC#
Created by IsNotNull on 7/11/2024 in #help
More Elegant Way to Make a Generic Lookup Type
@boiled goose I'll probably just change storageThing.Get<T>(key) to storageThing.Lookup<T>().Get(key) Doesn't avoid the need for a type lookup (that TypedDictionary would be perfect), but I can avoid the casting and if the consumer holds onto a specific lookup reference, then they can avoid the type lookup for all future calls.
15 replies
CC#
Created by IsNotNull on 7/11/2024 in #help
More Elegant Way to Make a Generic Lookup Type
It wouldn't save me having to cast the value results, but I'm guessing I'm stuck with that no matter what.
15 replies
CC#
Created by IsNotNull on 7/11/2024 in #help
More Elegant Way to Make a Generic Lookup Type
That would save a few operations per lookup (the hash of the type), so that is cool.
15 replies
CC#
Created by IsNotNull on 7/11/2024 in #help
More Elegant Way to Make a Generic Lookup Type
That is just assigning a surrogate integer ID for each type added?
15 replies
CC#
Created by IsNotNull on 7/11/2024 in #help
More Elegant Way to Make a Generic Lookup Type
c#
public class LookupByType
{
Dictionary<Type, object> internalLookup = new();
public void Add<TType>(TType value) => internalLookup.Add(typeof(TType), value);
public TValue Get<TValue>(Type type) => (TValue)internalLookup[type];
}
c#
public class LookupByType
{
Dictionary<Type, object> internalLookup = new();
public void Add<TType>(TType value) => internalLookup.Add(typeof(TType), value);
public TValue Get<TValue>(Type type) => (TValue)internalLookup[type];
}
15 replies
CC#
Created by JTN on 4/26/2024 in #help
✅ null thingy (SOLVED)
Its useful in larger projects, but I find it annoying sometimes when prototyping or for quick one-off projects.
21 replies
CC#
Created by JTN on 4/26/2024 in #help
✅ null thingy (SOLVED)
If you are learning and finding the null reference handling annoying or confusing... you can also disable it.
21 replies