New answers tagged c#
-1
votes
Who did async/await first?
Grand Central Dispatch was released in 2009, and was used to achieve the same as async/await. With very clumsy syntax in C or C++, slightly clumsy syntax in Objective-C and easier readable syntax in ...
0
votes
How to organize "master" data VS "working" data in MS SQL
CoW
This sounds like a
copy on write
situation.
You have an evolving table such as SurveyQuestion,
and you'd like for various callers to take a reference
to its current snapshot.
For simplicity I will ...
0
votes
Who did async/await first?
You should take promises into consideration:
promise = async something
result = await promise
Because it operates on promises or futures or similar.
Promises arrived to JavaScript with ES2015 (at ...
0
votes
Clean Architecture: Loading data for the domain layer
Somewhat similar to @user3347715's answer, I would design a FriendRelationship aggregate root that contains exactly the data perimeter needed to enforce your invariant. So, load user IDs remote from ...
2
votes
Clean Architecture: Loading data for the domain layer
The general approach here is going to be to model the interaction taking place. That is, make the implicit explicit. Let us add an additional concept to this system, FriendRequest, to carry some of ...
0
votes
Correct microservice project structure C#
I think what you are asking is this:
Type A
Service
{
SendEmailAboutThing(MyThing x)
{
this.emailer.Send(new Mail() {
Subject = x.Title
Body = x.Data1 + x.Data2
...
0
votes
Accepted
What C# Object Composition strategy would you apply for CoreObjects with a governing 'ObjectType' property
This DesignType determines various fundamental characteristics of the design object, and various calculated values of the design type may have different calculations based on the DesignType. The ...
0
votes
What is good practice when inheriting static classes isn't possible/allowed
I am very late to this party but will add an approach I often use in case it helps anyone in the future: The OOP principle of "composition over inheritance".
If I have multiple static ...
1
vote
How can I keep accurate time in a Windows Forms (WinForms) application?
IMHO you are approaching this from the wrong angle. As mentioned, the OS already provides a local time zone as an offset to the system time / UTC. Under modern Windows systems, it requires less clicks ...
3
votes
How can I keep accurate time in a Windows Forms (WinForms) application?
This sounds like you're in a pretty unenviable position, as you're expected to satisfy conflicting stupid requirements.
First off, messing with system time is a bad idea in general, especially when ...
2
votes
Accepted
How can I keep accurate time in a Windows Forms (WinForms) application?
Instead of capturing the start time and using a timer, capture the start time and record the operating system tick count.
StartTime = DateTime.Now; 'Or however you are currently computing it
StartTick ...
2
votes
Poolable classes with default custom properties/logic without affecting OOP hierarchy
I'll chime in from a more language-agnostic perspective. This is a common difficulty in class-based OO languages. The current solutions to this problem (that I can think of) are:
Code generation (...
1
vote
Where Refit interfaces fit in a Clean Architecture structure
You've struck on a key issue with attribute-based configuration. It tends to force you to reference your attributes on a level that you would rather keep agnostic.
This is why some developers start ...
3
votes
Poolable classes with default custom properties/logic without affecting OOP hierarchy
Your question raises many flags for possible response.
Firstly, "poolable" sounds like an instance-based behavior, not a type-based one. Overall I get the feeling that you're conflating the ...
2
votes
Poolable classes with default custom properties/logic without affecting OOP hierarchy
You can store the reference to the pool in a separate data structure and access it through extension methods.
Bearing in mind you have to maintain the pool itself somewhere, you probably already have ...
3
votes
Poolable classes with default custom properties/logic without affecting OOP hierarchy
Make the Poolable class generic that has the "value" contained inside it. So you would have something like Poolable<Player> which would allow players but not sprites. If the class is ...
1
vote
Poolable classes with default custom properties/logic without affecting OOP hierarchy
I think that the usual solution is to create a class that implements IPoolable and does the logic that makes a class poolable. Then an instance of this class is injected into the class that you want ...
1
vote
Accepted
MVVM: How and should I expose view models' models to other view models?
I've come up with an interesting solution where I introduce a new interface called IViewModelWithModel<TModel> which looks like this:
public interface IViewModelWithModel<TModel>
{
...
1
vote
MVVM: How and should I expose view models' models to other view models?
It looks like you have a fairly complicated problem with the undo and redo. However there are a few things that stand out to me in your post as "code smells"
"I've added a view model ...
Top 50 recent answers are included
Related Tags
c# × 4893.net × 655
design-patterns × 538
design × 447
object-oriented × 357
architecture × 269
domain-driven-design × 244
asp.net × 200
unit-testing × 185
object-oriented-design × 181
java × 173
asp.net-mvc × 170
entity-framework × 165
dependency-injection × 152
interfaces × 148
wpf × 139
database × 106
mvvm × 103
c++ × 95
asp.net-core × 91
sql × 87
multithreading × 87
programming-practices × 86
exceptions × 83
inheritance × 79