Context: I am prototyping in prep for (maybe) converting my WinForms app to WPF.
I make very simple tree view event handler for which the code is:
var treeViewItem = (TreeViewItem)e.NewValue;
var treeViewItemTag = treeViewItem.Tag;
if (treeViewItemTag == "ViewForAMs")
{
ObjectQuery<AccountManagerView> oq = entities.AccountManagerViews;
var q =
from c in oq
select c;
dataGrid1.ItemsSource = q.ToList();
}
and the XAML is:
<Window x:Class="AccountingWpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525" Loaded="Window_Loaded">
<DockPanel>
<TreeView Name="treeView1" ItemsSource="{Binding Folders}"
SelectedItemChanged="treeView1_SelectedItemChanged">
<TreeViewItem Header="Account Manager View" Tag="ViewForAMs"/>
</TreeView>
<DataGrid AutoGenerateColumns="True" Name="dataGrid1" />
</DockPanel>
</Window>
When I ran it, I fully expected to see my data grid get populated but the == comparison failed on the second line of code above.
The debugger shows this:
QUESTION: why were there no compile or runtime errors? (same question another way: what is actually being compared such that the == operator outputs FALSE?)