I noticed today that the MSDN article "User Profiles Object Model Overview" has a wrong code sample for the "correct way of retrieving a user profile property value". The code sample there will not work, because the object model in sharepoind doesnt have the methods and objects the sample code is using.
Therefore - here is my correct way:
if (Profile[this.UserProfilePropertyName].Count == 1) return Profile[this.UserProfilePropertyName].Value.ToString(); else { StringBuilder ret = new StringBuilder(""); UserProfileValueCollection values = Profile[this.UserProfilePropertyName]; System.Collections.IEnumerator allValues = values.GetEnumerator(); while(allValues.MoveNext()) { ret.Append(allValues.Current.ToString()); ret.Append(";"); } return ret.ToString(); }