Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
UdpReceiveResult.cs
Go to the documentation of this file.
2
3namespace System.Net.Sockets;
4
5public struct UdpReceiveResult : IEquatable<UdpReceiveResult>
6{
7 private readonly byte[] _buffer;
8
9 private readonly IPEndPoint _remoteEndPoint;
10
11 public byte[] Buffer => _buffer;
12
14
15 public UdpReceiveResult(byte[] buffer, IPEndPoint remoteEndPoint)
16 {
17 if (buffer == null)
18 {
19 throw new ArgumentNullException("buffer");
20 }
21 if (remoteEndPoint == null)
22 {
23 throw new ArgumentNullException("remoteEndPoint");
24 }
26 _remoteEndPoint = remoteEndPoint;
27 }
28
29 public override int GetHashCode()
30 {
31 if (_buffer == null)
32 {
33 return 0;
34 }
35 return _buffer.GetHashCode() ^ _remoteEndPoint.GetHashCode();
36 }
37
38 public override bool Equals([NotNullWhen(true)] object? obj)
39 {
41 {
42 return Equals(other);
43 }
44 return false;
45 }
46
48 {
49 if (object.Equals(_buffer, other._buffer))
50 {
51 return object.Equals(_remoteEndPoint, other._remoteEndPoint);
52 }
53 return false;
54 }
55
56 public static bool operator ==(UdpReceiveResult left, UdpReceiveResult right)
57 {
58 return left.Equals(right);
59 }
60
61 public static bool operator !=(UdpReceiveResult left, UdpReceiveResult right)
62 {
63 return !left.Equals(right);
64 }
65}
override int GetHashCode()
override bool Equals([NotNullWhen(true)] object? obj)
static bool operator==(UdpReceiveResult left, UdpReceiveResult right)
UdpReceiveResult(byte[] buffer, IPEndPoint remoteEndPoint)
bool Equals(UdpReceiveResult other)
static bool operator!=(UdpReceiveResult left, UdpReceiveResult right)