我正在閱讀關於MVC-Linq to SQL的教程。在這裏,我注意到他們正在使用的對象名稱下劃線(在對象名稱第一個字符),如「_dataContext」以下劃線開頭的對象名稱
下面是代碼:
using System.Collections.Generic;
using System.Linq;
namespace MvcApplication1.Models
{
public class MovieRepository : IMovieRepository
{
private MovieDataContext _dataContext;
public MovieRepository()
{
_dataContext = new MovieDataContext();
}
#region IMovieRepository Members
public IList<Movie> ListAll()
{
var movies = from m in _dataContext.Movies
select m;
return movies.ToList();
}
#endregion
}
}
我的問題是,什麼是使用這個的目的強調?
相關閱讀:[成員變量的下劃線前綴。 intellisense](http://stackoverflow.com/q/833811) – 2012-02-02 22:22:36