Merge pull request #1296 from dotnet/adegeo-fix-publish

Fix publishing of bad article
This commit is contained in:
Andy (Steve) De George
2022-02-01 16:28:38 -08:00
committed by GitHub
@@ -19,19 +19,22 @@ ms.assetid: 7b6c5e00-3771-46b4-9142-5a80d5864a5e
- The designer generates more efficient code.
> [!NOTE]
> Either apply the <xref:System.ComponentModel.DefaultValueAttribute> or provide `Reset`*PropertyName* and `ShouldSerialize`*PropertyName* methods. Do not use both.
> [!NOTE]
> 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.
```vb
Public Sub ResetMyFont()
Private Sub ResetMyFont()
MyFont = Nothing
End Sub
```
```csharp
public void ResetMyFont() {
private void ResetMyFont()
{
MyFont = null;
}
```
@@ -44,15 +47,16 @@ public void ResetMyFont() {
```vb
'Returns true if the font has changed; otherwise, returns false.
' The designer writes code to the form only if true is returned.
Public Function ShouldSerializeMyFont() As Boolean
Return Not (thefont Is Nothing)
Private Function ShouldSerializeMyFont() As Boolean
Return thefont IsNot Nothing
End Function
```
```csharp
// Returns true if the font has changed; otherwise, returns false.
// The designer writes code to the form only if true is returned.
public bool ShouldSerializeMyFont() {
private bool ShouldSerializeMyFont()
{
return thefont != null;
}
```
@@ -94,11 +98,11 @@ Public Class MyControl
End Set
End Property
Public Function ShouldSerializeMyFont() As Boolean
Return Not (thefont Is Nothing)
Private Function ShouldSerializeMyFont() As Boolean
Return thefont IsNot Nothing
End Function
Public Sub ResetMyFont()
Private Sub ResetMyFont()
MyFont = Nothing
End Sub
End Class
@@ -128,11 +132,13 @@ public class MyControl : Control {
}
}
public bool ShouldSerializeMyFont() {
private bool ShouldSerializeMyFont()
{
return thefont != null;
}
public void ResetMyFont() {
private void ResetMyFont()
{
MyFont = null;
}
}