Posts Encapsulate Field – Tip of week #12
Post
Cancel

Encapsulate Field – Tip of week #12

Last week I told you guys about, Extract Method. Today I am going to talk about Encapsulate Field in Refactor.

Encapsulation is very essintial part of OOPS. You can eaily encapsulate your field in VS.net using your Refactor option.

Its very simple to Encapsulate the field in VS.net you just need to right click on field – refactor – encapsulate field.

encapsulate

encapsulate1

After this the output is like,

14 private bool _isValid;

15

16 public bool IsValid1

17 {

18 get { return _isValid; }

19 set { _isValid = value; }

20 }

So you’ll have no troubles implementing Encapsulation in your code. VS.Net does this all for you.

Enjoy Coding!!!

</div>

This post is licensed under CC BY 4.0 by the author.