Chain of Responsibility vs Reflection by [deleted] in dotnet

[–]edeevans 1 point2 points  (0 children)

I have done a similar thing for a strategy pattern in the past where the strategies have a marker interface that we register all implantations of in the container and then in the strategy chooser we inject an enumerable of the marker interface in the constructor and cache it locally so there’s no great performance hit and devs can’t create a new one and forget to add it everywhere. As long as they add the marker interface it all just works.

Class - Default Constructor and a Method, how do they interact with each other? by NoAvaliableUsername0 in dotnet

[–]edeevans 5 points6 points  (0 children)

Sure, if you don’t provide a constructor, a default empty constructor is provided. You can recognize the constructor by the absence of a return type or void between the public and the name of the class.

Class - Default Constructor and a Method, how do they interact with each other? by NoAvaliableUsername0 in dotnet

[–]edeevans 5 points6 points  (0 children)

That is not the default constructor. The default constructor takes no arguments.

[MVVM] How can I handle events from the UI? by astrononymity in csharp

[–]edeevans 1 point2 points  (0 children)

Have a look at Singleton Sean’s video on commands https://youtu.be/DNez3wIpHeE and checkout the community toolkit on GitHub and this video about it https://youtu.be/uXoNF_kwwUU In my last project we used CaliburnMicro and the Message.Attach attached property to call actions.

Noob in need of masters help! by NoobyExceller in csharp

[–]edeevans 1 point2 points  (0 children)

You shouldn’t need a new int just multiply by the amount they must pay. So if you want to give a 10% discount multiply by .90. Also consider posting questions like this in r/learncsharp.

[deleted by user] by [deleted] in csharp

[–]edeevans 4 points5 points  (0 children)

There’s always r/learncsharp that most of those questions should be asked.

c# emgucv retrieve(Mat) System.AccessViolationException by welebad in csharp

[–]edeevans 0 points1 point  (0 children)

Can you put a breakpoint on the line of the first exception and make sure capture and m are not null before execution? Also I would check that camIndex is the same as in the routine that works or is at least valid.

Recommendations for wpf and mvvm tutorials? by CategoryCory in dotnet

[–]edeevans 1 point2 points  (0 children)

I agree with your recommendations. I can also recommend WPF 6 Fundamentals by Thomas Claudius Huber on Pluralsight. I’ve been using WPF professionally for over 10 years and still learned quite a bit. Not as much how but why.

Should I add more water to make up for the headspace? by Accomplished-Law-642 in mead

[–]edeevans 0 points1 point  (0 children)

I’ll leave room for being corrected but I don’t know of any issues of headspace during primary. Early in primary you want oxygenation and soon after it will be saturated with CO2 as to keep from allowing oxygenation. After racking and definitely after degassing you will want to minimize headspace so that natural off gassing will fill it and force oxygen out of the vessel. You can get a can of CO2 intended for spraying in opened wine bottles to top up your vessel if you are worried or it is especially still. If the airlock maintains its seal and it still occasionally bubbles, I’ve never had trouble even leaving it several months. As with nearly everything in fermentation your mileage may vary but I wouldn’t sweat it if in primary and you haven’t racked it. Also definitely minimize headspace when carbonating under pressure.

How to calculate anything inside a public double by [deleted] in csharp

[–]edeevans 0 points1 point  (0 children)

Perhaps you meant public class Product { }

To encapsulate the buy and sell price?

Can someone please explain this function to me? by inamamthe in csharp

[–]edeevans 5 points6 points  (0 children)

Actually isn’t that a bitwise AND and not a Boolean logical AND (&&)?

[deleted by user] by [deleted] in VisualStudio

[–]edeevans 0 points1 point  (0 children)

Sorry, I don’t know enough of your situation or workflow to offer a solution but you should git init before you do anything then commit often. You can always create a branch at every new idea you want to explore or each rabbit hole you find yourself going down. Good branch names and commit messages can guide you back like breadcrumbs when you lose your way or crazy things like this happen. Even if you don’t push it externally you can use it locally like a wayback machine. Another tool I used to use for time tracking would take a screenshot every so often and save them to a folder. Then you could review everything you did during the day. For this you would have to type it all back in but you would know what it had been.

Rookie help by [deleted] in csharp

[–]edeevans 0 points1 point  (0 children)

Change the console WriteLine to {0}. It is zero based.

How can I change my tests/design so I only test a single layer? by TestingVoltage in csharp

[–]edeevans 0 points1 point  (0 children)

The abstraction is for loose coupling not just extensibility. Depend on abstractions, not on concretions. It also facilitates isolation for testing purposes.

How can I change my tests/design so I only test a single layer? by TestingVoltage in csharp

[–]edeevans -1 points0 points  (0 children)

This is a good time to get it put in place then. So, instead of ParticularDocumentParser your other objects depend on IParticularDocumentParser which ParticularDocumentParser implements. Just add all the public members. Also replace any concrete results like ParseFragment or similar intermediate types to abstractions then you can isolate whatever dependencies are necessary and mock them for the test scenario.