private struct MultiRating { public float totalRating; public int totalVotes; public MultiRating(float rating){ this.totalRating = rating; this.totalVotes = 1; } public float Rating { get { return this.totalRating / (float) this.totalVotes; } set { this.totalRating += value; this.totalVotes += 1; } } public float TotalRating { get { return this.totalRating; } } public float TotalVotes { get { return this.totalVotes; } } } public List GenerateNextSongs(int count) { Dictionary songs = new Dictionary(); foreach(SongRating sr in this.UserRatings) { if (songs.ContainsKey(sr.Song)) // PROBLEM HERE: songs[sr.Song].Rating = sr.Rating; else songs.Add(sr.Song, new MultiRating(sr.Rating)); } // ... } // Error: error CS1612: Cannot modify the return value of `System.Collections.Generic.Dictionary.this[...]' because it is not a variable