Olipro
Olipro
CC#
Created by Yukonヌ on 11/18/2024 in #help
Get another writeline on second itteration
It's also pretty basic so I suspect a lot of the suggestions here are possibly out of reach without explaining more programming concepts
211 replies
CC#
Created by Yukonヌ on 11/18/2024 in #help
Get another writeline on second itteration
If this isn't a homework question I will eat my hat
211 replies
CC#
Created by honey the codewitch on 11/15/2024 in #help
How to get a Type by string without specifying the assembly name, if it's among loaded asms
Iterate AppDomain.GetAssemblies and try and retrieve your desired type from each one
3 replies
CC#
Created by Olipro on 11/14/2024 in #help
IDisposable ownership semantics
What you're saying about the GC is also not quite accurate either since .NET implements a generational garbage collector, it's not simply mark & sweep
28 replies
CC#
Created by Olipro on 11/14/2024 in #help
IDisposable ownership semantics
This is irrelevant to the question. IDisposable is not supposed to be left to the GC to deal with.
28 replies
CC#
Created by Olipro on 11/14/2024 in #help
IDisposable ownership semantics
this could be simplified by immediately constructing a new Bitmap from the one that has the Stream so that the originals can then be Dispose'd but that'll absolutely massacre performance.
28 replies
CC#
Created by Olipro on 11/14/2024 in #help
IDisposable ownership semantics
the compounding issue is that if a Bitmap is constructed from a Stream impl, you can't Dispose() the stream until after the Bitmap is disposed
28 replies
CC#
Created by Olipro on 11/14/2024 in #help
IDisposable ownership semantics
for reference, I'm cleaning up a bunch of code that currently leaks Bitmap all over the place
28 replies
CC#
Created by Olipro on 11/14/2024 in #help
IDisposable ownership semantics
I know it's correct, I was hoping that in 2024 we don't still have to do this C-like crap. But I appreciate the validation 🙂
28 replies
CC#
Created by Olipro on 11/14/2024 in #help
IDisposable ownership semantics
a lot of code I've seen that uses IDisposable types seems to essentially ignore the problem and hopes that the type has a finalizer that'll do the job when the GC gets around to collecting it
28 replies
CC#
Created by Olipro on 11/14/2024 in #help
IDisposable ownership semantics
What I'm trying to express is code that complies with CA2000 - which requires that all IDisposable types aren't leaked.
28 replies
CC#
Created by Olipro on 11/14/2024 in #help
IDisposable ownership semantics
This is primarily a question regarding whether or not C# has introduced any sort of syntactic sugar or support for a "nicer" way of expressing transfer of ownership.
28 replies
CC#
Created by Olipro on 11/14/2024 in #help
IDisposable ownership semantics
the method has no obligation nor desire to catch exceptions. This is doing what finally would do, except we've now made it more long-winded because we'd have to rethrow, for no reason
28 replies
CC#
Created by Olipro on 11/14/2024 in #help
IDisposable ownership semantics
we are returning a type that implements IDisposable, if the method causes Dispose() to be invoked on the object, it's now returning an unusable instance.
28 replies
CC#
Created by Olipro on 11/14/2024 in #help
IDisposable ownership semantics
using is invalid because it would result in calling Dispose on the object it's returning.
28 replies
CC#
Created by Olipro on 11/12/2024 in #help
Selecting and filtering from a list with full nullable safety & warnings as errors
meaning, if I understand this correctly, that ValueTuple/Tuple have no such constraints
54 replies
CC#
Created by Olipro on 11/12/2024 in #help
Selecting and filtering from a list with full nullable safety & warnings as errors
I see, if I'm understanding this right, whether it's allowed to work or not is dependent on whether or not you define constraints: https://learn.microsoft.com/en-us/dotnet/csharp/nullable-references#generics
54 replies
CC#
Created by Olipro on 11/12/2024 in #help
Selecting and filtering from a list with full nullable safety & warnings as errors
Arrays and structs that contain reference types are known pitfalls in nullable references and the static analysis that determines null safety. In both situations, a non-nullable reference might be initialized to null, without generating warnings.
:cough:
54 replies
CC#
Created by Olipro on 11/12/2024 in #help
Selecting and filtering from a list with full nullable safety & warnings as errors
that makes structs a bit of a turnoff for me if they essentially have inferior nullability safety
54 replies
CC#
Created by Olipro on 11/12/2024 in #help
Selecting and filtering from a list with full nullable safety & warnings as errors
I suspect this isn't unique to ValueTuple - I imagine this is applicable to all struct types and it seems this is by design: https://learn.microsoft.com/en-us/dotnet/csharp/nullable-references#structs
54 replies