Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
C# is a multiparadigm, managed, garbage-collected object-oriented programming language created by Microsoft in parallel with the .NET platform
1
vote
Should utility base classes be avoided
I could create an interface and a concretion, but then the implementation isn't portable
There's a design trade-off between using a sealed class (or a class with a finite number of subclasses) an …
1
vote
suggest structure for classes that maps to json with dynamic data without using dynamic or o...
If I'm understanding you correctly, you're trying to find a statically-typed way to say "a value of type Section can be either a value of type Highlights, Chart, or Tweets". There are many terms for t …
3
votes
Is this a good way to compare two numbers?
From Comparing Floating Point Numbers, 2012 Edition
There is no silver bullet. You have to choose wisely.
If you are comparing against zero, then relative epsilons and ULPs based comparisons …
4
votes
Using struct to enforce validation of built-in type
This is fairly common in ML-style languages like Standard ML/OCaml/F#/Haskell where it's much easier to create the wrapper types. It provides you with two benefits:
It allows a piece of code to enfo …
3
votes
Avoiding a large amount of overloads
From your comments it seems you have something like this:
Send(Data data, Address address, A a, B b, C c) { ... }
Send(Data data, Address address, A a, D d, E e, F f) { ... }
Send(Data data, Addres …
4
votes
Accepted
Is there a name for this in type theory? Specify that a value satisfies multiple interfaces ...
Scala allows this and calls the resulting type a Compound Type. Your example would look something like this in Scala:
def seekAndRead(stream: IReaderStream with ISeekable) {
stream.seek(5) // OK
…
7
votes
Am I wrong in thinking that needing something like AutoMapper is an indication of poor design?
There is a deeper issue here: the fact that C# and Java insist most/all types must be distinguishable by name rather than structure: e.g. class MyPoint2D and class YourPoint2D are separate types even …
0
votes
Gathering IP address and workstation information; does it belong in a state class?
It seems to me on 2nd through that it's meant to be a class that should hold state, and not know how to call out to the .NET Framework to find info.
Spot on. What you have is just a data containe …
5
votes
Accepted
Does laziness yield more race conditions?
Your first link does address the issue - it's laziness combined with side effects that is problematic, because the order of side effects matters.
For pure computations, the main thing that changes is …
2
votes
Alternatives to #if when polymorphism doesn't seem possible
Conditional compilation effectively creates multiple versions of the code base. That's exactly the purpose of version control branches.
The other alternative is put whatever code needs to vary in its …
1
vote
Segregating interfaces/concerns to a tree
It seems like the presentation and data should be defined in separate classes, but I can't think of a good way to do this while maintaining the ability to traverse the tree. Any suggestions?
The …
1
vote
How To Invoke A Method When It's Class is Accessed (Any Method) - "OnClassEnter"
Disclaimer: My C# experience is probably less than 8 hours total so the syntax that follows may not be accurate.
So, somewhere between Device1.Method1; and Device2.Method3; When switching between …
0
votes
Relative encapsulation design
A simple solution would be to make them immutable and produce new world objects for the next world state. This gives the Level complete control over the world's state without allowing objects to inter …
3
votes
How to enforce implementation of interface to behave a certain way
You can't. That's the thing about interfaces - they allow anyone to implement them at any time. There's an infinite number of potential implementations for your interface, and you can't force any of t …
1
vote
Data structures VS Classes and what happens if they merge?
I would assume this to be a data structure.
Specifically, it's a record.
Like a method to add new offers because there's more logic in doing so than just adding it to the list?
Is there som …