小编Tim*_* W.的帖子

如何在Cloud Formation模板中使列表项有条件?

我有以下云形成模板,用于创建代码管道.管道有三个阶段:

  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)

aws-cloudformation aws-codepipeline

12
推荐指数
2
解决办法
2954
查看次数

不使用[Serializable]时[NonSerialized]的好处

我正在查看我正在处理的项目中的一些现有代码,我找到了一个实现为:

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]还有一些额外的好处吗?

c# serialization nonserializedattribute

11
推荐指数
3
解决办法
7903
查看次数