LINQ in Action roller

Error 1 'KontorAdminSys.Window1.GetOfficeByName(string)': not all code paths return a value

What am I doing wrong? code from Window1.xaml.cs: private Office GetOfficeByName( string s) { try { IEnumerable Office > query = from b in _dataDc.Offices select b; foreach ( Office o in query) { if (o.OfficeName.Equals(s)) return o; else return null ; } } catch ( Exception ex) { Console .Write( "Error: " + ex.Message); } } private void btnA1_MouseEnter( object sender, MouseEventArgs e) { Office o = GetOfficeByName( "A1" ); // temp, for testing only btnA1.ToolTip = Convert .ToString(o.OfficeName); Read More...
Published Wednesday, May 28, 2008 2:10 AM by MSDN Forums: LINQ Project General
Anonymous comments are disabled

Featured Item

This Blog

Sponsoring

Syndication