GetHashCode
How do I use Get Hash Code
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
Line | Code | Ex.. |
---|---|---|
133 | int h1 = s.GetHashCode(); | 1 |
127 | return (pp != null && this.GetHashCode() == pp.GetHashCode()); | 2 |
130 | public override int GetHashCode() | 3 |
155 | public override int GetHashCode() | 4 |
File name: ServerSettingsInspector.cs
Copy
127 private int RpcListHashCode()
128 {
129 // this is a hashcode generated to (more) easily compare this Editor's RPC List with some other
130 int hashCode = PhotonEditor.Current.RpcList.Count + 1;
131 foreach (string s in PhotonEditor.Current.RpcList)
132 {
133 int h1 = s.GetHashCode();
134 hashCode = ((h1 << 5) + h1) ^ hashCode;
135 }
136
137 return hashCode;
138 }
File name: PhotonPlayer.cs
Copy
124 public override bool Equals(object p)
125 {
126 PhotonPlayer pp = p as PhotonPlayer;
127 return (pp != null && this.GetHashCode() == pp.GetHashCode());
128 }
File name: PhotonPlayer.cs
Copy
130 public override int GetHashCode()
131 {
132 return this.ID;
133 }
File name: RoomInfo.cs
Copy
155 public override int GetHashCode()
156 {
157 return this.nameField.GetHashCode();
158 }
GetHashCode 137 lượt xem
Gõ tìm kiếm nhanh...