我有以下云形成模板,用于创建代码管道.管道有三个阶段:
Stages:
-
Name: "Source"
Actions:
-
Name: "Source"
ActionTypeId:
Category: "Source"
Owner: "ThirdParty"
Version: "1"
Provider: "GitHub"
OutputArtifacts:
- Name: "MyApp"
Configuration:
Owner: !Ref GithubOwner
Repo: !Ref GithubRepo
PollForSourceChanges: "true"
Branch: !Ref GithubBranch
OAuthToken: !Ref GithubTokenParameter
RunOrder: 1
-
Name: "Run-Unit-Tests"
Actions:
-
InputArtifacts:
- Name: "MyApp"
Name: "UnitTests"
ActionTypeId:
Category: "Test"
Owner: "AWS"
Version: "1"
Provider: "CodeBuild"
OutputArtifacts:
- Name: "MyTests"
Configuration:
ProjectName: !Ref CodeBuildName
RunOrder: 1
-
Name: "Deploy-Staging"
Actions:
-
InputArtifacts:
- Name: "MyApp"
Name: "Deploy-Staging" …Run Code Online (Sandbox Code Playgroud) 我正在查看我正在处理的项目中的一些现有代码,我找到了一个实现为:
public class ThingOne
{
private int A;
private int B;
[NonSerialized]
private System.Timers.Timer timer1;
}
Run Code Online (Sandbox Code Playgroud)
它不应该看起来更像这样吗?
[Serializable]
public class ThingOne
{
private int A;
private int B;
[NonSerialized]
private System.Timers.Timer timer1;
}
Run Code Online (Sandbox Code Playgroud)
或者,即使类本身不是Serializable,添加[NonSerialized]还有一些额外的好处吗?