小编Rad*_*anu的帖子

NSwag Enum 生成从 0 开始

我在 API 上声明了一个枚举,如下所示:

 public enum Currencies
    {
        RON = 1,
        USD,
        EUR,
        GBP,
        CHF,
        PLN,
        CAD,
        HUF,
        NOK,
        SEK
    }
Run Code Online (Sandbox Code Playgroud)

但是当我使用 NSwag 生成 HttpClient 时,它从 0 开始,我得到:

public enum Currencies
    {

        [System.Runtime.Serialization.EnumMember(Value = @"RON")]
        RON = 0,

        [System.Runtime.Serialization.EnumMember(Value = @"USD")]
        USD = 1,

        [System.Runtime.Serialization.EnumMember(Value = @"EUR")]
        EUR = 2,

        [System.Runtime.Serialization.EnumMember(Value = @"GBP")]
        GBP = 3,

        [System.Runtime.Serialization.EnumMember(Value = @"CHF")]
        CHF = 4,

        [System.Runtime.Serialization.EnumMember(Value = @"PLN")]
        PLN = 5,

        [System.Runtime.Serialization.EnumMember(Value = @"CAD")]
        CAD = 6,

        [System.Runtime.Serialization.EnumMember(Value = @"HUF")]
        HUF = 7,

        [System.Runtime.Serialization.EnumMember(Value …
Run Code Online (Sandbox Code Playgroud)

web swagger swagger-ui asp.net-core nswag

4
推荐指数
1
解决办法
861
查看次数

订阅 Angular Material Mat-Drawer 事件 .. 例如:openChange

我正在使用 mat-drawer 并且我想在关联的组件中收到通知,当打开和关闭 mat-drawer 以添加一些逻辑时;

html 具有以下结构:

<mat-drawer-container class="example-container"  autosize>
<mat-drawer #drawer class="custom-sidenav" mode="side">
    <div>
  <button routerLink="/" routerLinkActive="active"
   style="margin-top: 50px" mat-button class="small" (click)="showFiller = !showFiller" >
    <mat-icon style="color: red">home</mat-icon>
  <b style="margin-left: 20px">Home</b>
  </button>
</div>
  <div>
  <button routerLink="/transactions" routerLinkActive="active" style="margin-top: 20px" mat-button class="small" (click)="showFiller = !showFiller" >
    <mat-icon style="color:gray">trending_flat</mat-icon>
  <b matBadge="{{totalTransactions}}" matBadgeColor="red" matBadgeOverlap="false" style="margin-left: 20px">Transactions</b>
  </button>
</div>
  <div *ngIf="isAdmin">
        <button routerLink="/fetch-data" routerLinkActive="active" style="margin-top: 20px" mat-button class="small" (click)="showFiller = !showFiller" >
            <mat-icon  matBadge="{{totalCertificates}}" matBadgePosition="before" matBadgeColor="accent"  style="color:gray">description</mat-icon>
          <b style="margin-left: 20px">Certificates</b>
          </button>
  </div>
  <div> …
Run Code Online (Sandbox Code Playgroud)

javascript angular-material angular angular5 angular6

1
推荐指数
1
解决办法
2942
查看次数

C#custom添加到List中

我有以下字符串列表:

var files = new List<string> {"file0","file1","file2","file3" };
Run Code Online (Sandbox Code Playgroud)

我希望能够将新文件添加到此列表中,但如果插入的文件存在于列表中,我想插入符合以下格式的自定义值$"{StringToBeInserted}"("{SomeCounter}

例如:尝试添加"file0"和"file0"已经是我想要插入"file0(1)".如果我再次尝试添加"file0"...我想插入"file0(2)"等等...另外,我想提供一致性,例如,如果我删除"file0(1) "...并尝试再次添加"item0"......我希望添加"item0(1)".有人可以帮助我使用通用算法吗?

.net c# linq algorithm

-6
推荐指数
1
解决办法
77
查看次数