mirror of
https://github.com/Stone-Red-Code/docs-desktop.git
synced 2026-09-04 09:06:04 +02:00
Merge pull request #1296 from dotnet/adegeo-fix-publish
Fix publishing of bad article
This commit is contained in:
+18
-12
@@ -19,19 +19,22 @@ ms.assetid: 7b6c5e00-3771-46b4-9142-5a80d5864a5e
|
|||||||
|
|
||||||
- The designer generates more efficient code.
|
- The designer generates more efficient code.
|
||||||
|
|
||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
> Either apply the <xref:System.ComponentModel.DefaultValueAttribute> or provide `Reset`*PropertyName* and `ShouldSerialize`*PropertyName* methods. Do not use both.
|
> Either apply the <xref:System.ComponentModel.DefaultValueAttribute> or provide `Reset`*PropertyName* and `ShouldSerialize`*PropertyName* methods. Do not use both.
|
||||||
|
|
||||||
|
When declaring a `ShouldSerialize` or `Reset` method, use the `private` access modifier. These methods are usually invoked by the designer and not by user code.
|
||||||
|
|
||||||
The `Reset`*PropertyName* method sets a property to its default value, as shown in the following code fragment.
|
The `Reset`*PropertyName* method sets a property to its default value, as shown in the following code fragment.
|
||||||
|
|
||||||
```vb
|
```vb
|
||||||
Public Sub ResetMyFont()
|
Private Sub ResetMyFont()
|
||||||
MyFont = Nothing
|
MyFont = Nothing
|
||||||
End Sub
|
End Sub
|
||||||
```
|
```
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
public void ResetMyFont() {
|
private void ResetMyFont()
|
||||||
|
{
|
||||||
MyFont = null;
|
MyFont = null;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@@ -44,15 +47,16 @@ public void ResetMyFont() {
|
|||||||
```vb
|
```vb
|
||||||
'Returns true if the font has changed; otherwise, returns false.
|
'Returns true if the font has changed; otherwise, returns false.
|
||||||
' The designer writes code to the form only if true is returned.
|
' The designer writes code to the form only if true is returned.
|
||||||
Public Function ShouldSerializeMyFont() As Boolean
|
Private Function ShouldSerializeMyFont() As Boolean
|
||||||
Return Not (thefont Is Nothing)
|
Return thefont IsNot Nothing
|
||||||
End Function
|
End Function
|
||||||
```
|
```
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
// Returns true if the font has changed; otherwise, returns false.
|
// Returns true if the font has changed; otherwise, returns false.
|
||||||
// The designer writes code to the form only if true is returned.
|
// The designer writes code to the form only if true is returned.
|
||||||
public bool ShouldSerializeMyFont() {
|
private bool ShouldSerializeMyFont()
|
||||||
|
{
|
||||||
return thefont != null;
|
return thefont != null;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@@ -94,11 +98,11 @@ Public Class MyControl
|
|||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
Public Function ShouldSerializeMyFont() As Boolean
|
Private Function ShouldSerializeMyFont() As Boolean
|
||||||
Return Not (thefont Is Nothing)
|
Return thefont IsNot Nothing
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Sub ResetMyFont()
|
Private Sub ResetMyFont()
|
||||||
MyFont = Nothing
|
MyFont = Nothing
|
||||||
End Sub
|
End Sub
|
||||||
End Class
|
End Class
|
||||||
@@ -128,11 +132,13 @@ public class MyControl : Control {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool ShouldSerializeMyFont() {
|
private bool ShouldSerializeMyFont()
|
||||||
|
{
|
||||||
return thefont != null;
|
return thefont != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ResetMyFont() {
|
private void ResetMyFont()
|
||||||
|
{
|
||||||
MyFont = null;
|
MyFont = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user