github.com/myhau/pulumi/pkg/v3@v3.70.2-0.20221116134521-f2775972e587/codegen/testing/test/testdata/regress-node-8110/dotnet/Enums.cs (about)

     1  // *** WARNING: this file was generated by test. ***
     2  // *** Do not edit by hand unless you're certain you know what you are doing! ***
     3  
     4  using System;
     5  using System.ComponentModel;
     6  using Pulumi;
     7  
     8  namespace Pulumi.My8110
     9  {
    10      [EnumType]
    11      public readonly struct MyEnum : IEquatable<MyEnum>
    12      {
    13          private readonly string _value;
    14  
    15          private MyEnum(string value)
    16          {
    17              _value = value ?? throw new ArgumentNullException(nameof(value));
    18          }
    19  
    20          public static MyEnum One { get; } = new MyEnum("one");
    21          public static MyEnum Two { get; } = new MyEnum("two");
    22  
    23          public static bool operator ==(MyEnum left, MyEnum right) => left.Equals(right);
    24          public static bool operator !=(MyEnum left, MyEnum right) => !left.Equals(right);
    25  
    26          public static explicit operator string(MyEnum value) => value._value;
    27  
    28          [EditorBrowsable(EditorBrowsableState.Never)]
    29          public override bool Equals(object? obj) => obj is MyEnum other && Equals(other);
    30          public bool Equals(MyEnum other) => string.Equals(_value, other._value, StringComparison.Ordinal);
    31  
    32          [EditorBrowsable(EditorBrowsableState.Never)]
    33          public override int GetHashCode() => _value?.GetHashCode() ?? 0;
    34  
    35          public override string ToString() => _value;
    36      }
    37  }