You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Fix nullable warning
The compiler was throwing a warning that it was possible for the constructer to return null in certain circumstances.
This rearranges the function so that cannot happen.
* Fix CodeSmell: Use NullReferenceException
* Fix comments
* Remove messages from exception constructors
- Also add compiler defs to disable sonarcloud analysis on exceptions.
* Fix param check on constructor
* Fix comment close tags
* More fixes in comments tags
Co-authored-by: José Simões <jose.simoes@eclo.solutions>
thrownewArgumentOutOfRangeException($"Index out of range");
98
+
#pragma warning disable S3928// Parameter names used into ArgumentException constructors should match an existing one
99
+
thrownewArgumentOutOfRangeException();
100
+
#pragma warning restore S3928// Parameter names used into ArgumentException constructors should match an existing one
78
101
}
79
102
80
103
return_array[_start+index];
@@ -83,7 +106,9 @@ public byte this[int index]
83
106
{
84
107
if(index>=_length)
85
108
{
86
-
thrownewArgumentOutOfRangeException($"Index out of range");
109
+
#pragma warning disable S3928// Parameter names used into ArgumentException constructors should match an existing one
110
+
thrownewArgumentOutOfRangeException();
111
+
#pragma warning restore S3928// Parameter names used into ArgumentException constructors should match an existing one
87
112
}
88
113
89
114
_array[_start+index]=value;
@@ -111,13 +136,15 @@ public byte this[int index]
111
136
/// </summary>
112
137
/// <param name="destination"> The destination System.Span object.</param>
113
138
/// <exception cref="System.ArgumentException">
114
-
/// destination is shorter than the source System.Span.
139
+
/// destination is shorter than the source <see cref="SpanByte"/>.
115
140
/// </exception>
116
141
publicvoidCopyTo(SpanBytedestination)
117
142
{
118
143
if(destination.Length<_length)
119
144
{
120
-
thrownewArgumentException($"Destination too small");
145
+
#pragma warning disable S3928// Parameter names used into ArgumentException constructors should match an existing one
146
+
thrownewArgumentException();
147
+
#pragma warning restore S3928// Parameter names used into ArgumentException constructors should match an existing one
121
148
}
122
149
123
150
for(inti=0;i<_length;i++)
@@ -127,35 +154,37 @@ public void CopyTo(SpanByte destination)
127
154
}
128
155
129
156
/// <summary>
130
-
/// Forms a slice out of the current span that begins at a specified index.
157
+
/// Forms a slice out of the current <see cref="SpanByte"/> that begins at a specified index.
131
158
/// </summary>
132
159
/// <param name="start">The index at which to begin the slice.</param>
133
160
/// <returns>A span that consists of all elements of the current span from start to the end of the span.</returns>
134
-
/// <exception cref="System.ArgumentOutOfRangeException">start is less than zero or greater than System.Span.Length.</exception>
161
+
/// <exception cref="System.ArgumentOutOfRangeException"><paramref name="start"/> is < zero or > <see cref="Length"/>.</exception>
135
162
publicSpanByteSlice(intstart)
136
163
{
137
164
returnSlice(start,_length-start);
138
165
}
139
166
140
167
/// <summary>
141
-
/// Forms a slice out of the current span starting at a specified index for a specified length.
168
+
/// Forms a slice out of the current <see cref="SpanByte"/> starting at a specified index for a specified length.
142
169
/// </summary>
143
170
/// <param name="start">The index at which to begin this slice.</param>
144
171
/// <param name="length">The desired length for the slice.</param>
145
-
/// <returns>A span that consists of lengthelements from the current span starting at start.</returns>
146
-
/// <exception cref="System.ArgumentOutOfRangeException">start or start + length is less than zero or greater than System.Span.Length.</exception>
172
+
/// <returns>A <see cref="SpanByte"/> that consists of <paramref name="length"/> number of elements from the current <see cref="SpanByte"/> starting at <paramref name="start"/>.</returns>
173
+
/// <exception cref="System.ArgumentOutOfRangeException"><paramref name="start"/> or <paramref name="start"/> + <paramref name="length"/> is < zero or > <see cref="Length"/>.</exception>
147
174
publicSpanByteSlice(intstart,intlength)
148
175
{
149
176
if((start<0)||(length<0)||(start+length>_length))
150
177
{
151
-
thrownewArgumentOutOfRangeException($"start or start + length is less than zero or greater than length");
178
+
#pragma warning disable S3928// Parameter names used into ArgumentException constructors should match an existing one
179
+
thrownewArgumentOutOfRangeException();
180
+
#pragma warning restore S3928// Parameter names used into ArgumentException constructors should match an existing one
152
181
}
153
182
154
183
returnnewSpanByte(_array,_start+start,length);
155
184
}
156
185
157
186
/// <summary>
158
-
/// Copies the contents of this span into a new array.
187
+
/// Copies the contents of this <see cref="SpanByte"/> into a new array.
159
188
/// </summary>
160
189
/// <returns> An array containing the data in the current span.</returns>
161
190
publicbyte[]ToArray()
@@ -170,7 +199,7 @@ public byte[] ToArray()
170
199
}
171
200
172
201
/// <summary>
173
-
/// Implicit conversion of an array to a span of byte
202
+
/// Implicit conversion of an array to a <see cref="SpanByte"/>.
0 commit comments