Declaring a property or method as virtual means that derived classes can override that property or method. This is particularly useful when using a proxy pattern which some ORMs use in implementing lazy loading (for example, nHibernate). As such, when using
such technologies, it becomes necessary to mark those properties as virtual. [In c# things are not virtual unless explicitly mentioned, unlike in Java]
"If I can see further than anyone else, it is only because I am standing on the shoulders of giants."blog: www.heartysoft.com twitter: @ashic
Marked as answer by HeartattacK on May 05, 2012 10:33 AM
HeartattacK
All-Star
55288 Points
5920 Posts
Moderator
MVP
Re: Use of Virtual Keyword in defining the Class
May 05, 2012 09:42 AM|LINK
Declaring a property or method as virtual means that derived classes can override that property or method. This is particularly useful when using a proxy pattern which some ORMs use in implementing lazy loading (for example, nHibernate). As such, when using such technologies, it becomes necessary to mark those properties as virtual. [In c# things are not virtual unless explicitly mentioned, unlike in Java]
blog: www.heartysoft.com
twitter: @ashic