@@ -9,8 +9,6 @@ namespace System.Net.NetworkInformation
9
9
{
10
10
internal static partial class StringParsingHelpers
11
11
{
12
- private static readonly string [ ] s_newLineSeparator = new string [ ] { Environment . NewLine } ; // Used for string splitting
13
-
14
12
internal static int ParseNumSocketConnections ( string filePath , string protocolName )
15
13
{
16
14
// Parse the number of active connections out of /proc/net/sockstat
@@ -32,7 +30,7 @@ internal static TcpConnectionInformation[] ParseActiveTcpConnectionsFromFiles(st
32
30
if ( tcp4ConnectionsFile != null )
33
31
{
34
32
string tcp4FileContents = ReadAllText ( tcp4ConnectionsFile ) ;
35
- v4connections = tcp4FileContents . Split ( s_newLineSeparator , StringSplitOptions . RemoveEmptyEntries ) ;
33
+ v4connections = tcp4FileContents . Split ( Environment . NewLine , StringSplitOptions . RemoveEmptyEntries ) ;
36
34
}
37
35
else
38
36
{
@@ -42,7 +40,7 @@ internal static TcpConnectionInformation[] ParseActiveTcpConnectionsFromFiles(st
42
40
if ( tcp6ConnectionsFile != null )
43
41
{
44
42
string tcp6FileContents = ReadAllText ( tcp6ConnectionsFile ) ;
45
- v6connections = tcp6FileContents . Split ( s_newLineSeparator , StringSplitOptions . RemoveEmptyEntries ) ;
43
+ v6connections = tcp6FileContents . Split ( Environment . NewLine , StringSplitOptions . RemoveEmptyEntries ) ;
46
44
}
47
45
else
48
46
{
@@ -112,7 +110,7 @@ internal static IPEndPoint[] ParseActiveTcpListenersFromFiles(string? tcp4Connec
112
110
if ( tcp4ConnectionsFile != null )
113
111
{
114
112
string tcp4FileContents = ReadAllText ( tcp4ConnectionsFile ) ;
115
- v4connections = tcp4FileContents . Split ( s_newLineSeparator , StringSplitOptions . RemoveEmptyEntries ) ;
113
+ v4connections = tcp4FileContents . Split ( Environment . NewLine , StringSplitOptions . RemoveEmptyEntries ) ;
116
114
}
117
115
else
118
116
{
@@ -122,7 +120,7 @@ internal static IPEndPoint[] ParseActiveTcpListenersFromFiles(string? tcp4Connec
122
120
if ( tcp6ConnectionsFile != null )
123
121
{
124
122
string tcp6FileContents = ReadAllText ( tcp6ConnectionsFile ) ;
125
- v6connections = tcp6FileContents . Split ( s_newLineSeparator , StringSplitOptions . RemoveEmptyEntries ) ;
123
+ v6connections = tcp6FileContents . Split ( Environment . NewLine , StringSplitOptions . RemoveEmptyEntries ) ;
126
124
}
127
125
else
128
126
{
@@ -192,7 +190,7 @@ public static IPEndPoint[] ParseActiveUdpListenersFromFiles(string? udp4File, st
192
190
if ( udp4File != null )
193
191
{
194
192
string udp4FileContents = ReadAllText ( udp4File ) ;
195
- v4connections = udp4FileContents . Split ( s_newLineSeparator , StringSplitOptions . RemoveEmptyEntries ) ;
193
+ v4connections = udp4FileContents . Split ( Environment . NewLine , StringSplitOptions . RemoveEmptyEntries ) ;
196
194
}
197
195
else
198
196
{
@@ -202,7 +200,7 @@ public static IPEndPoint[] ParseActiveUdpListenersFromFiles(string? udp4File, st
202
200
if ( udp6File != null )
203
201
{
204
202
string udp6FileContents = ReadAllText ( udp6File ) ;
205
- v6connections = udp6FileContents . Split ( s_newLineSeparator , StringSplitOptions . RemoveEmptyEntries ) ;
203
+ v6connections = udp6FileContents . Split ( Environment . NewLine , StringSplitOptions . RemoveEmptyEntries ) ;
206
204
}
207
205
else
208
206
{
0 commit comments