|
Think about it...
To fire an Async method from a property, you would first have to call a synchronous method that fires the Async method.
So essentially You have blocking call.
If it's not broken, fix it until it is
|
|
|
|
|
Yes, but I meant:
MSDN wrote: Do use a method, rather than a property, in the following situations.
The operation is orders of magnitude slower than a field set would be. If you are even considering providing an asynchronous version of an operation to avoid blocking the thread, it is very likely that the operation is too expensive to be a property. In particular, operations that access the network or the file system (other than once for initialization) should most likely be methods, not properties.
From Design guidelines, Choosing Between Properties and Methods[^]
|
|
|
|
|
And we know MSDN is always right.
There are many times when a property change triggers an async call. All Im suggesting is tha it start at the property
If it's not broken, fix it until it is
|
|
|
|
|
Kevin Marois wrote: There are many times when a property change triggers an async call.
Actually, I tend to disagree. It's still a side-effect. A property setter should do only that -- set the underlying field value, which changes the state of the object for just that property. Doing anything else obscures the fact that the setter does something that potentially affects the rest of the application, or has additional hidden state changes of the object itself. If you really need an async operation, personally, I would code a method like await UpdateCustomer(selectedCustomer); , which is a lot clearer.
Marc
|
|
|
|
|
Ok, so the user drops down a list of customers. Requirements call for the newly selected customer to be loaded.
What calls UpdateCustomer(selectedCustomer)?
Combo bound to prop. Prop fires call to get Customer async.
Very common scenario.
If it's not broken, fix it until it is
|
|
|
|
|
Kevin Marois wrote: Combo bound to prop.
Ah, an interesting use case! Yeah, now that I understand the bigger picture, I see what you mean. Gotta love (not) how .NET makes it so easy to entangle the view, controller, and model.
Marc
|
|
|
|
|
Marc Clifton wrote: Gotta love (not) how .NET makes it so easy to entangle the view, controller, and model.
The view is bound to the VM. That's how it's done. Not sure I get what you mean. You sound like you think this is a bad thing?
Of course you could wire up the combo's change event but that's just more code as apposed to a line of code in the prop's setter.
Not sure if I see one more advantages over the other.
If it's not broken, fix it until it is
|
|
|
|
|
Kevin Marois wrote: The view is bound to the VM.
ah ok.
Marc
|
|
|
|
|
I'm confused. Isn't that the exact purpose of the INotifyPropertyChanged Interface?
|
|
|
|
|
|
Ahem. It's in the insider news page already.
This space for rent
|
|
|
|
|
Has this been confirmed?
The lack of a company name, and the fact that it appears to be based entirely based on a discussion in a chatroom, make it look like a prank.
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|
|
You know, I searched the lounge, not the insider. I shall now go to the woodshed for my beating .
Confirmed for this guy? No idea. I do know that all of the unix guys I worked with mapped the rm command to a shell script. Normally, the prompt would be something like "Are you really sure you want to do this?"
I've seen guys wipe the wrong folders. That damn command is fast, no time taken to calculate how long things will take.
Charlie Gilley
<italic>Stuck in a dysfunctional matrix from which I must escape...
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|
|
Search the Help Wanted ads. If he's there, it's confirmed.
If it's not broken, fix it until it is
|
|
|
|
|
Nothing wrong with "rm -rf" at all if you know what you are doing and paying attention. Unix/Linux does not try to baby you like Windows does, so you have to be careful as root.
|
|
|
|
|
Chainsaw with no chain brake. Comes with a big boy warranty, I agree.
Charlie Gilley
<italic>Stuck in a dysfunctional matrix from which I must escape...
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|
|
The first question that came to my mind was, "what, no recycle bin with an undo option"? Oh yeah, it's Linux.
Marc
|
|
|
|
|
You only do it once.
Charlie Gilley
<italic>Stuck in a dysfunctional matrix from which I must escape...
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|
|
I have to wonder what would happen using the rm command in the new bash shell in Windows 10
Anyone want to try and report back?
|
|
|
|
|
charlieg wrote: typing rm -rf
We have 20+ options for VMs, partial VMs (like docker) and chroot. rm -rf could be safe.
|
|
|
|
|
Are the hard drives in a MacBook Pro just a normal HDD like you'd buy for a desktop or laptop, or are they some proprietary thing? I ask because a friend's computer "crashed" and he was worried about data loss. I've been 99% successful at recovering data from desktop and laptop drives and was wondering if this would be the same song & dance.
Thanks.
DC
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Nothing special. It's just a normal drive like any other.
|
|
|
|
|
They're just sata drives BUT:
Someone brought a newer Mac Book Pro to our PC fixit shop and after some just difficulty with just about everything you can imagine, we were told we could not download the OS to a blank drive we bought for them but would have to take it to an Apple Store so the "teks" there could register the drive. WTF? Ok so Apple's mad at the world again, great.
We gave we computer and the new drive to the customer so he could drive 90 miles to stinkin Boulder Colorado and the techs there said in no way would they use the new drive we bought. So great, Apple's mad at the world again.
We used to do this all the time before you had to get the OS from the mother ship.
Cloning the disk was out of the question as there where no may bad areas in the OS area, we would have had the same situation on a new drive.
I hope your mileage varies.
|
|
|
|
|
There's no such thing as "registering" the drive. I just did a drive upgrade on my Dad's MacBook Pro (HDD to SSD) and it was really easy with SuperDuper. Attach the new drive over USB, start up SuperDuper, copy the internal drive to the SSD and wait. Once the copy is done, take the old drive out of the machine and put the SSD in its place. Done. Works like charm.
|
|
|
|
|
Oh no, that's not how it went. Apparently if you want to download the OS on to bare metal these days you have to take it to an Apple Store. We still think they were lying but, we sure as $%^& couldn't do it. When we consulted Apple by phone about our error message / condition that is what they told us. We have been doing this for 30 years. We've never heard of such a thing up until last month either. t
Apple's mad at the world again and want to have all the service if they can again.
Cloning a disk as you have done with SuperDuper with has no restrictions. We couldn't clone it as it was too far gone in all the wrong places as stated in my post.
MVPs should read OPs more thoroughly.
|
|
|
|