Click here to Skip to main content
15,889,865 members
Home / Discussions / C#
   

C#

 
GeneralRe: Reactive Extensions and WeakEvents Pin
Sascha Lefèvre30-Jan-16 6:20
professionalSascha Lefèvre30-Jan-16 6:20 
GeneralRe: Reactive Extensions and WeakEvents Pin
Kenneth Haugland30-Jan-16 7:29
mvaKenneth Haugland30-Jan-16 7:29 
GeneralRe: Reactive Extensions and WeakEvents Pin
Sascha Lefèvre30-Jan-16 8:06
professionalSascha Lefèvre30-Jan-16 8:06 
AnswerRe: Reactive Extensions and WeakEvents Pin
Sascha Lefèvre30-Jan-16 11:42
professionalSascha Lefèvre30-Jan-16 11:42 
GeneralRe: Reactive Extensions and WeakEvents Pin
Kenneth Haugland31-Jan-16 1:19
mvaKenneth Haugland31-Jan-16 1:19 
GeneralRe: Reactive Extensions and WeakEvents Pin
Sascha Lefèvre31-Jan-16 1:42
professionalSascha Lefèvre31-Jan-16 1:42 
GeneralRe: Reactive Extensions and WeakEvents Pin
Kenneth Haugland31-Jan-16 4:24
mvaKenneth Haugland31-Jan-16 4:24 
GeneralRe: Reactive Extensions and WeakEvents Pin
Sascha Lefèvre31-Jan-16 6:34
professionalSascha Lefèvre31-Jan-16 6:34 
Kenneth Haugland wrote:
This should greatly reduce typing errors (and enable intellisence) compared to requesting a string of the property name only.
Yes, that's the purpose of the Expression.

Kenneth Haugland wrote:
I assume that TProperty is basically just the result that returns an unidentified object?
TProperty is just the expected type of the property (string in the case of the code I posted before). The expression doesn't do anything by itself, it just enables us to specify the property in a safer way because the compiler checks for us that its return type is of TProperty. The expression then ends up being "dissected" by us again in ObservePropertyChanged(..) in order to get the property name.

It's not completely compile-time safe because you could specify something else than a property which is also returning the correct type of TProperty. That's why those checks are there in ObservePropertyChanged(..) to ensure (at runtime) that the expression is "pointing" at a property. But even that isn't completely safe because you'd still able to call it like this x => someNonTTargetTypedObject.SomeTPropertyTypedProperty.
That could be also be checked though. Maybe an exercise for you Wink | ;-)
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson

GeneralRe: Reactive Extensions and WeakEvents Pin
Kenneth Haugland31-Jan-16 7:29
mvaKenneth Haugland31-Jan-16 7:29 
GeneralRe: Reactive Extensions and WeakEvents Pin
Kenneth Haugland31-Jan-16 11:27
mvaKenneth Haugland31-Jan-16 11:27 
QuestionTableLayoutPanel and .. surprise surprise .. weird behaviour 8) Pin
Emanuele Bonin30-Jan-16 1:24
Emanuele Bonin30-Jan-16 1:24 
Answer[SOLVED] TableLayoutPanel and .. surprise surprise .. weird behaviour 8) Pin
Emanuele Bonin30-Jan-16 2:17
Emanuele Bonin30-Jan-16 2:17 
GeneralRe: [SOLVED] TableLayoutPanel and .. surprise surprise .. weird behaviour 8) Pin
BillWoodruff30-Jan-16 2:46
professionalBillWoodruff30-Jan-16 2:46 
GeneralRe: [SOLVED] TableLayoutPanel and .. surprise surprise .. weird behaviour 8) Pin
Emanuele Bonin30-Jan-16 6:18
Emanuele Bonin30-Jan-16 6:18 
AnswerRe: TableLayoutPanel and .. surprise surprise .. weird behaviour 8) Pin
BillWoodruff30-Jan-16 2:39
professionalBillWoodruff30-Jan-16 2:39 
QuestionSubscribe to property changes using Reactive Extensions Pin
Kenneth Haugland29-Jan-16 2:18
mvaKenneth Haugland29-Jan-16 2:18 
AnswerRe: Subscribe to property changes using Reactive Extensions Pin
Pete O'Hanlon29-Jan-16 3:25
mvePete O'Hanlon29-Jan-16 3:25 
GeneralRe: Subscribe to property changes using Reactive Extensions Pin
Kenneth Haugland29-Jan-16 4:47
mvaKenneth Haugland29-Jan-16 4:47 
GeneralRe: Subscribe to property changes using Reactive Extensions Pin
Richard Deeming29-Jan-16 5:03
mveRichard Deeming29-Jan-16 5:03 
GeneralRe: Subscribe to property changes using Reactive Extensions Pin
Kenneth Haugland29-Jan-16 5:22
mvaKenneth Haugland29-Jan-16 5:22 
AnswerRe: Subscribe to property changes using Reactive Extensions Pin
Richard Deeming29-Jan-16 3:31
mveRichard Deeming29-Jan-16 3:31 
GeneralRe: Subscribe to property changes using Reactive Extensions Pin
Kenneth Haugland29-Jan-16 4:56
mvaKenneth Haugland29-Jan-16 4:56 
AnswerRe: Subscribe to property changes using Reactive Extensions Pin
Sascha Lefèvre29-Jan-16 3:49
professionalSascha Lefèvre29-Jan-16 3:49 
GeneralRe: Subscribe to property changes using Reactive Extensions Pin
Kenneth Haugland29-Jan-16 4:59
mvaKenneth Haugland29-Jan-16 4:59 
GeneralRe: Subscribe to property changes using Reactive Extensions Pin
Sascha Lefèvre29-Jan-16 5:30
professionalSascha Lefèvre29-Jan-16 5:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.