﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>Peter Morris commented on If stupidity was money, I would be rich</title><description>I think moving the selected state up to a containing class would speed things up because it would let you use a HashSet
&lt;t instead of looping through all items (which may or may not be selected).
  
  
private HashSet
&lt;istatementmodel SelectedItems;
  
  
public bool IsSelected(IStatementModel item)
  
{
  
  return SelectedItems.Contains(item);
  
}
  
  
pubic void Select(IStatementModel item)
  
{
  
  SelectedItems.Add(item);
  
}
  
  
pubic void Deselect(IStatementModel item)
  
{
  
  SelectedItems.Remove(item);
  
}
  
  
public void SetSingleSelected(IStatementModel item)
  
{
  
  SelectedItems.Clear();
  
  Select(item);
  
}
  
  
  
Pete
  
&gt;</description><link>http://ayende.com/4050/if-stupidity-was-money-i-would-be-rich#comment8</link><guid>http://ayende.com/4050/if-stupidity-was-money-i-would-be-rich#comment8</guid><pubDate>Mon, 08 Jun 2009 07:39:38 GMT</pubDate></item><item><title>Peter Morris commented on If stupidity was money, I would be rich</title><description>Ah, okay.
</description><link>http://ayende.com/4050/if-stupidity-was-money-i-would-be-rich#comment7</link><guid>http://ayende.com/4050/if-stupidity-was-money-i-would-be-rich#comment7</guid><pubDate>Sun, 07 Jun 2009 20:54:44 GMT</pubDate></item><item><title>Ayende Rahien commented on If stupidity was money, I would be rich</title><description>Bill,
  
The problem was that I didn't update my version of the source, there was no other problem.
  
I forgot to update and was _not_ running on the same version
</description><link>http://ayende.com/4050/if-stupidity-was-money-i-would-be-rich#comment6</link><guid>http://ayende.com/4050/if-stupidity-was-money-i-would-be-rich#comment6</guid><pubDate>Sun, 07 Jun 2009 19:29:00 GMT</pubDate></item><item><title>Ayende Rahien commented on If stupidity was money, I would be rich</title><description>Peter,
  
There may be more than one selected statement
</description><link>http://ayende.com/4050/if-stupidity-was-money-i-would-be-rich#comment5</link><guid>http://ayende.com/4050/if-stupidity-was-money-i-would-be-rich#comment5</guid><pubDate>Sun, 07 Jun 2009 19:26:29 GMT</pubDate></item><item><title>Bill Barry commented on If stupidity was money, I would be rich</title><description>This was the primary reason I had for switching to a dvcs. Given two machines:
  
on 1:
  
commit revision 15
  
build
  
  
on 2:
  
update to revision 15
  
build
  
  
The fact that these two builds are not always the same is mildly unnerving (given svn, cvs or tfs). It also makes bugs like these far harder to find than they should be.
  
  
</description><link>http://ayende.com/4050/if-stupidity-was-money-i-would-be-rich#comment4</link><guid>http://ayende.com/4050/if-stupidity-was-money-i-would-be-rich#comment4</guid><pubDate>Sun, 07 Jun 2009 19:23:10 GMT</pubDate></item><item><title>Peter Morris commented on If stupidity was money, I would be rich</title><description>Rather than a foreach loop wouldn't it be better to do something like this?
  
  
set
  
{
  
  if (selectedValue == value)
  
    return;
  
  
  if (selectedValue != null)
  
    selectedValue.IsSelected = false;
  
  selectedValue = value;
  
  if (selectedValue != null)
  
    selectedValue.IsSelected = true;
  
  RaisePropertyChanged("SelectedValue");
  
}
</description><link>http://ayende.com/4050/if-stupidity-was-money-i-would-be-rich#comment3</link><guid>http://ayende.com/4050/if-stupidity-was-money-i-would-be-rich#comment3</guid><pubDate>Sun, 07 Jun 2009 18:49:40 GMT</pubDate></item><item><title>anon commented on If stupidity was money, I would be rich</title><description>Wouldn't the following raise and exception (presuming you're not checking the result to the value returned from the SelectedStatement property in the calling code)?
  
  
someObject.SelectedStatement = null; //Property not changed, assuming it was init'ed to null
  
IStatementModel sm = object.selectedStatement; //Get Property value (which is null)
  
sm.someCall ;//Use sm without checking for null - NullReferenceException thrown
  
</description><link>http://ayende.com/4050/if-stupidity-was-money-i-would-be-rich#comment2</link><guid>http://ayende.com/4050/if-stupidity-was-money-i-would-be-rich#comment2</guid><pubDate>Sun, 07 Jun 2009 18:43:17 GMT</pubDate></item><item><title>Rob commented on If stupidity was money, I would be rich</title><description>Oops...
</description><link>http://ayende.com/4050/if-stupidity-was-money-i-would-be-rich#comment1</link><guid>http://ayende.com/4050/if-stupidity-was-money-i-would-be-rich#comment1</guid><pubDate>Sun, 07 Jun 2009 16:51:36 GMT</pubDate></item></channel></rss>