It will try to cast the DataContext as a type of InspectionsByTasksViewModel.
Biggest advantage or disadvantage of as keyword is, that the as operator is like a cast operation. But, if the conversion isn't possible, as returns null instead of raising an exception.
Regards,
Chinmay.
kaufmed
By the looks of it, this is not initialization,
Well, vm is being initialized...it's just being initialized based on what you described ;)
Tom Knowlton
ASKER
You're correct; I did not give much surrounding code or context. Here is a screenshot of an example where this is taking place.
I should have mentioned that this was inside of a XAML application, and apparently "DataContext" belongs to the FrameworkElement, which apparently is part of XAML (I'm brand new to XAML).
I've just never seen initialization of a class instance done via casting?
If you would post the entire code snippet it would have been easier to explain. By the looks of it, this is not initialization, this is casting.
https://docs.microsoft.com
It will try to cast the DataContext as a type of InspectionsByTasksViewMode
Biggest advantage or disadvantage of as keyword is, that the as operator is like a cast operation. But, if the conversion isn't possible, as returns null instead of raising an exception.
Regards,
Chinmay.