سؤال

What is the shortcut for auto-implementing a property in vb.net? I want get/set and associated field, like with "propfull" in C#.

I'm using VS12 with ReSharper 7.1.3

هل كانت مفيدة؟

المحلول

you can declare property just like this without get or set

Property Prop2 As String = "Empty"

this is equivalent to

Private _Prop2 As String = "Empty" 
Property Prop2 As String 
    Get 
        Return _Prop2
    End Get 
    Set(ByVal value As String)
        _Prop2 = value
    End Set 
End Property

here are the details http://msdn.microsoft.com/en-us/library/dd293589.aspx

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top