Skip to content

Commit d730ee5

Browse files
committed
Override ToString() methods instead of using new keyword
Updated three ToString() methods in SIPSorcery.SIP (SIPHeader.cs) to use the override keyword, ensuring proper method overriding and improved polymorphic behavior.
1 parent e371fcc commit d730ee5

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/SIPSorcery/core/SIP/SIPHeader.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ public static SIPViaHeader[] ParseSIPViaHeader(string viaHeaderStr)
355355
}
356356
}
357357

358-
public new string ToString()
358+
public override string ToString()
359359
{
360360
return $"{SIPHeaders.SIP_HEADER_VIA}: {this.Version}/{this.Transport.ToString().ToUpper()} {ContactAddress}{((ViaParameters != null && ViaParameters.Count > 0) ? ViaParameters.ToString() : null)}";
361361
}
@@ -1191,7 +1191,7 @@ public void ReplaceRoute(string origSocket, string replacementSocket)
11911191
}
11921192
}
11931193

1194-
public new string ToString()
1194+
public override string ToString()
11951195
{
11961196
if (m_sipRoutes != null && m_sipRoutes.Count > 0)
11971197
{
@@ -1311,7 +1311,7 @@ public void PushViaHeader(SIPViaHeader viaHeader)
13111311
m_viaHeaders.Insert(0, viaHeader);
13121312
}
13131313

1314-
public new string ToString()
1314+
public override string ToString()
13151315
{
13161316
if (m_viaHeaders != null && m_viaHeaders.Count > 0)
13171317
{

0 commit comments

Comments
 (0)