« first day (4322 days earlier)      last day (609 days later) » 

2:08 AM
1/12 every single event
 
 
3 hours later…
 
3 hours later…
7:19 AM
[Squirrel in Training] GoOoOoOoOoOoOoOoOoOoOoOd Mornin' pleberinos!
 
 
4 hours later…
even I say default interface implementations is not a thing now
maybe in next C# version, they fix the bug and introduce real default interface implementations
 
Not a fan of default interface implementations. Ever since they were added in Java.
 
you must only have seen people abuse them then
especially in Java they are useful
 
No, I know there is a use case. I just think it's way too narrow to add the feature.
 
in C#, you could use it to get more control of default parameters
and the option to expand interfaces without breaking contract
 
11:50 AM
Hey all, I've got a question about linq optimization. I'm using this

public bool AnyFlippedCards() => tabs.SelectMany(stack => stack.toArray()).Any(card => !card.AsUCard().IsFaceUp);.

Is there a way I can save the linq pipe and just use it over and over without having to create a new one on evey call?
 
what you want to reuse? xy.SelectMany(x => x.ToArray())...?
tabs can be different in different places?
 
The whole thing if possible. Tabs are created at the start. Assume the Tabs will not change during the lifetime.
 
give it to a variable then
private bool _anyFlippedCards = ...;
 
Okay, the tabs don't change but the cards.IsFaceUp will change.
 
or you can use Lazy<bool> if tabs is only available at the point of first requesting the variable
ohh
store tabs.SelectMany(stack => stack.toArray()) in variable, rest stays as method
 
12:01 PM
So would I save everything before the All. i.e. Ienumerator<cards> tabCards = tabs.SelectMany(stack => stack.toArray()).
 
@Wietlol It does exist man
 
Then call IsAllFaceup() => tabCards.All(card => card.AsUCard().IsFaceUp);
 
private List<Card> _tabCards = tabs.SelectMany(stack => stack.toArray()).ToList();
IsAllFaceup() => _tabCards.All(card => card.AsUCard().IsFaceUp);
yes
 
I appreciate the help. Have a great day.
 
no problem. You too
 
12:07 PM
@Squirrelintraining but it is so wrong
 
@Wietlol no
 
it hides the methods on subtypes
 
[Squirrel in Training] Oh wow you just described inheritance!
 
normally, when using inheritance, it doesnt hide the methods
 
[Squirrel in Training] It does if you overrwrite them
 
12:10 PM
that is why you dont have to explicitly cast your lists to collections before you can use the add function
var list = new List<string>();
((ICollection<string>) list).Add("myValue");
^ this is stupid, hence why compilers will try to understand where your method call comes from by themselves
but noooo, default interfaces must not do this because we decide that you should explicitly use the interface if you want default implementations
if you do var x = new MyClass();, you can not call the default implemented methods
unless you upcast it specifically to the interface
 
[Squirrel in Training] I don't get you lion head
 
interface IAmInterface
{
    void Foo()
    {
        Console.WriteLine("Foo");
    }
}

class MyClass : IAmInterface
{}

public static void Main()
{
    var x = new MyClass();
    x.Foo();
    // ERROR: Cannot resolve symbol 'Foo'
    // ERROR: 'MyClass' does not contain a definition for 'Foo' and no accessible extension method 'Foo' accepting a first argument of type 'MyClass' could be found (are you missing a using directive or an assembly reference?)
}
meanwhile:
((IAmInterface) x).Foo(); // oh ofcource it comes from IAmInterface, duh
you, as developer, have to explicitly state where the method comes from using upcasting
which is the most stupid thing you, as developer, can be asked to do
now you say: "obviously, you shouldnt have used var"
but now imagine that I have multiple interfaces with default implementations?
or that I have other methods in my class that I want to access?
it is just stupid
that is why, in every language I know, upcasting is not mandatory (unless there is ambiguity)
except C#
and this detail prevents developers from using it in about half of the use cases
especially code modules and traits
 
[Squirrel in Training] Now I get you lion head
\[**[Squirrel in Training](https://discord.gg/PNMq3pBSUe)**] Welp eversince I am mostly working with the abstractions (aka. the interfaces) I realy havn't had that Problem yet.
Ofcourse it sucks what you described there.
[Squirrel in Training] I guess it exists as a lazy fix for multi-inheirtance of default imnplementations
 
12:27 PM
it exists for interop stuff, traits and adding stuff to existing interfaces
allegedly
I cant talk about the interop stuff, but traits and adding more stuff to an interface certainly has degraded since this "feature" was released
 
12:58 PM
posted on August 16, 2022 by Richard Lander

Summary of your post, shown on the home page next to the featured image The post .NET 6 is now in Ubuntu 22.04 appeared first on .NET Blog.

 
 
3 hours later…
4:04 PM
posted on August 16, 2022 by Marc Goodner

We released Visual Studio 2022 17.4 Preview 1 last week alongside the 17.3 generally available release. In this post we’ll share details about some of the new capabilities in this preview and the focus of this release. Feedback from developers like you during our preview cycle is so important for us to deliver a final product that meets your high expectations. The post What’s New i

 

« first day (4322 days earlier)      last day (609 days later) »