How to use alias for the common use constant in .NET

Posted by Admin L in .NET Programming on 19-11-2012. Tags: , , , , , , ,

Author: Nosa Lee
Original Address:
To reprint this article, please indicate the source, thank you.

For example in VB .NET:
Such as we need to write the string like MsgBoxStyle.Information every time, if you feel it is too long, you can use an alias to replace it (in fact it will not be slow for writing, just occupies the code space).

Imports MBS = Microsoft.VisualBasic.MsgBoxStyle
And then you can use MBS.Information to replace MsgBoxStyle.Information in this module.

Usually, we may need to enjoy this short alias in whole project, how to do?
It is very easy, just import it at the References property page of the project.

Please see the following screenshot to know it clear:
Import Alias for Constant in .NET

【赞赏 / Reward】

微信         支付宝         PayPal

Post a comment