BadScript 2
Loading...
Searching...
No Matches
ParameterModel.cs
Go to the documentation of this file.
1using System;
2
4
5public readonly struct ParameterModel : IEquatable<ParameterModel>
6{
7 public readonly bool IsContext;
8 public readonly string? Name;
9 public readonly string? Description;
10 public readonly string? Type;
11 public readonly string? CsharpType;
12 public readonly bool IsNullable;
13 public readonly bool HasDefaultValue;
14 public readonly string? DefaultValue;
15 public readonly bool IsRestArgs;
16
18 bool isContext,
19 bool hasDefaultValue = false,
20 string? defaultValue = null,
21 string? name = null,
22 string? description = null,
23 string? type = null,
24 string? csharpType = null,
25 bool isNullable = false,
26 bool isRestArgs = false)
27 {
28 IsContext = isContext;
29 HasDefaultValue = hasDefaultValue;
30 DefaultValue = defaultValue;
31 Name = name;
32 Description = description;
33 Type = type;
34 CsharpType = csharpType;
35 IsNullable = isNullable;
36 IsRestArgs = isRestArgs;
37 }
38
39 public bool Equals(ParameterModel other)
40 {
41 return IsContext == other.IsContext &&
42 Name == other.Name &&
43 Description == other.Description &&
44 Type == other.Type &&
45 CsharpType == other.CsharpType &&
46 IsNullable == other.IsNullable &&
47 HasDefaultValue == other.HasDefaultValue &&
48 DefaultValue == other.DefaultValue &&
49 IsRestArgs == other.IsRestArgs;
50 }
51
52 public override bool Equals(object? obj)
53 {
54 return obj is ParameterModel other && Equals(other);
55 }
56
57 public override int GetHashCode()
58 {
59 unchecked
60 {
61 int hashCode = IsContext.GetHashCode();
62 hashCode = hashCode * 397 ^ (Name != null ? Name.GetHashCode() : 0);
63 hashCode = hashCode * 397 ^ (Description != null ? Description.GetHashCode() : 0);
64 hashCode = hashCode * 397 ^ (Type != null ? Type.GetHashCode() : 0);
65 hashCode = hashCode * 397 ^ (CsharpType != null ? CsharpType.GetHashCode() : 0);
66 hashCode = hashCode * 397 ^ IsNullable.GetHashCode();
67 hashCode = hashCode * 397 ^ HasDefaultValue.GetHashCode();
68 hashCode = hashCode * 397 ^ (DefaultValue != null ? DefaultValue.GetHashCode() : 0);
69 hashCode = hashCode * 397 ^ IsRestArgs.GetHashCode();
70
71 return hashCode;
72 }
73 }
74
75 public static bool operator ==(ParameterModel left, ParameterModel right)
76 {
77 return left.Equals(right);
78 }
79
80 public static bool operator !=(ParameterModel left, ParameterModel right)
81 {
82 return !left.Equals(right);
83 }
84}
static bool operator!=(ParameterModel left, ParameterModel right)
ParameterModel(bool isContext, bool hasDefaultValue=false, string? defaultValue=null, string? name=null, string? description=null, string? type=null, string? csharpType=null, bool isNullable=false, bool isRestArgs=false)
static bool operator==(ParameterModel left, ParameterModel right)