Take a look at the `DirectionCalculation` Revit SDK sample and The Building Coder discussion of it 
on south facing walls:
 
http://thebuildingcoder.typepad.com/blog/2010/01/south-facing-walls.html
 
That will provide a good starting point for you.
 
It uses the built-in wall function parameter `FUNCTION_PARAM` to filter for exterior walls.
 
I updated the code presented there and added it to The Building Coder samples for you, in the CmdCollectorPerformance.cs module lines L293-L323:
 
https://github.com/jeremytammik/the_building_coder_samples
 
https://github.com/jeremytammik/the_building_coder_samples/blob/master/BuildingCoder/BuildingCoder/C...
 
First, we implement a predicate method `IsExterior` that checks this parameter value to determine whether a wall type is exterior or not:
 
  /// <summary>
  /// Wall type predicate for exterior wall function
  /// </summary>
  bool IsExterior( WallType wallType )
  {
    Parameter p = wallType.get_Parameter(
      BuiltInParameter.FUNCTION_PARAM );
    Debug.Assert( null != p, "expected wall type "
      + "to have wall function parameter" );
    WallFunction f = (WallFunction) p.AsInteger();
    return WallFunction.Exterior == f;
  }
 
With that, you can retrieve all exterior walls with a filtered element collector like this:
 
  /// <summary>
  /// Return all exterior walls
  /// </summary>
  IEnumerable<Element> GetAllExteriorWalls(
    Document doc )
  {
    return new FilteredElementCollector( doc )
      .OfClass( typeof( Wall ) )
      .Cast<Wall>()
      .Where<Wall>( w =>
        IsExterior( w.WallType ) );
  }
 
Since the wall function filter is just checking a parameter value, the performance of this filtering process could be significantly enhanced by using a parameter filter instead of the slow .NET based `IsExterior` method post-processing:
 
http://thebuildingcoder.typepad.com/blog/2010/06/parameter-filter.html
 
Cheers,
 
Jeremy