diff --git a/src/LinkDotNet.StringBuilder/ValueStringBuilder.Concat.Helper.cs b/src/LinkDotNet.StringBuilder/ValueStringBuilder.Concat.Helper.cs
index 12987d3..f8ca793 100644
--- a/src/LinkDotNet.StringBuilder/ValueStringBuilder.Concat.Helper.cs
+++ b/src/LinkDotNet.StringBuilder/ValueStringBuilder.Concat.Helper.cs
@@ -5,15 +5,15 @@ namespace LinkDotNet.StringBuilder;
public ref partial struct ValueStringBuilder
{
///
- /// Concatenates multiple objects together.
+ /// Concatenates the string representation of multiple objects together.
///
- /// Values to be concatenated together.
- /// Any given type, which can be translated to .
- /// Concatenated string or an empty string if is empty.
+ /// Values to be concatenated.
+ /// Any type for that can be converted to .
+ /// The concatenated string, or an empty string if is empty.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static string Concat(params scoped ReadOnlySpan values)
{
- if (values.Length == 0)
+ if (values.IsEmpty)
{
return string.Empty;
}
@@ -25,13 +25,28 @@ public static string Concat(params scoped ReadOnlySpan values)
}
///
- /// Concatenates two different types together.
+ /// Creates the string representation of an object.
///
- /// Typeparameter of .
- /// Typeparameter of .
- /// First argument.
- /// Second argument.
- /// String representation of the concateneted result.
+ /// Any type for that can be converted to .
+ /// First value to be concatenated.
+ /// The string representation of the object.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static string Concat(T1 arg1)
+ {
+ using var sb = new ValueStringBuilder(stackalloc char[128]);
+ sb.AppendInternal(arg1);
+
+ return sb.ToString();
+ }
+
+ ///
+ /// Concatenates the string representation of two objects together.
+ ///
+ /// Any type for that can be converted to .
+ /// Any type for that can be converted to .
+ /// First value to be concatenated.
+ /// Second value to be concatenated.
+ /// The concatenated string.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static string Concat(T1 arg1, T2 arg2)
{
@@ -43,15 +58,15 @@ public static string Concat(T1 arg1, T2 arg2)
}
///
- /// Concatenates two different types together.
+ /// Concatenates the string representation of three objects together.
///
- /// Typeparameter of .
- /// Typeparameter of .
- /// Typeparameter of .
- /// First argument.
- /// Second argument.
- /// Third argument.
- /// String representation of the concateneted result.
+ /// Any type for that can be converted to .
+ /// Any type for that can be converted to .
+ /// Any type for that can be converted to .
+ /// First value to be concatenated.
+ /// Second value to be concatenated.
+ /// Third value to be concatenated.
+ /// The concatenated string.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static string Concat(T1 arg1, T2 arg2, T3 arg3)
{
@@ -64,17 +79,17 @@ public static string Concat(T1 arg1, T2 arg2, T3 arg3)
}
///
- /// Concatenates two different types together.
+ /// Concatenates the string representation of four objects together.
///
- /// Typeparameter of .
- /// Typeparameter of .
- /// Typeparameter of .
- /// Typeparameter of .
- /// First argument.
- /// Second argument.
- /// Third argument.
- /// Fourth argument.
- /// String representation of the concateneted result.
+ /// Any type for that can be converted to .
+ /// Any type for that can be converted to .
+ /// Any type for that can be converted to .
+ /// Any type for that can be converted to .
+ /// First value to be concatenated.
+ /// Second value to be concatenated.
+ /// Third value to be concatenated.
+ /// Fourth value to be concatenated.
+ /// The concatenated string.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static string Concat(T1 arg1, T2 arg2, T3 arg3, T4 arg4)
{
@@ -88,19 +103,19 @@ public static string Concat(T1 arg1, T2 arg2, T3 arg3, T4 arg4)
}
///
- /// Concatenates two different types together.
+ /// Concatenates the string representation of five objects together.
///
- /// Typeparameter of .
- /// Typeparameter of .
- /// Typeparameter of .
- /// Typeparameter of .
- /// Typeparameter of .
- /// First argument.
- /// Second argument.
- /// Third argument.
- /// Fourth argument.
- /// Fifth argument.
- /// String representation of the concateneted result.
+ /// Any type for that can be converted to .
+ /// Any type for that can be converted to .
+ /// Any type for that can be converted to .
+ /// Any type for that can be converted to .
+ /// Any type for that can be converted to .
+ /// First value to be concatenated.
+ /// Second value to be concatenated.
+ /// Third value to be concatenated.
+ /// Fourth value to be concatenated.
+ /// Fifth value to be concatenated.
+ /// The concatenated string.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static string Concat(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5)
{
diff --git a/tests/LinkDotNet.StringBuilder.UnitTests/ValueStringBuilderTests.cs b/tests/LinkDotNet.StringBuilder.UnitTests/ValueStringBuilderTests.cs
index adb41f5..0c7b67e 100644
--- a/tests/LinkDotNet.StringBuilder.UnitTests/ValueStringBuilderTests.cs
+++ b/tests/LinkDotNet.StringBuilder.UnitTests/ValueStringBuilderTests.cs
@@ -1,4 +1,4 @@
-namespace LinkDotNet.StringBuilder.UnitTests;
+namespace LinkDotNet.StringBuilder.UnitTests;
public class ValueStringBuilderTests
{
@@ -363,7 +363,15 @@ public void ShouldConcatStringsTogether()
}
[Fact]
- public void ConcatDifferentTypesWithTwoArguments()
+ public void ShouldConcatOneObjectTogether()
+ {
+ var result = ValueStringBuilder.Concat(1);
+
+ result.ShouldBe("1");
+ }
+
+ [Fact]
+ public void ShouldConcatTwoObjectsTogether()
{
var result = ValueStringBuilder.Concat("Test", 1);
@@ -371,7 +379,7 @@ public void ConcatDifferentTypesWithTwoArguments()
}
[Fact]
- public void ConcatDifferentTypesWithThreeArguments()
+ public void ShouldConcatThreeObjectsTogether()
{
var result = ValueStringBuilder.Concat("Test", 1, 2);
@@ -379,7 +387,7 @@ public void ConcatDifferentTypesWithThreeArguments()
}
[Fact]
- public void ConcatDifferentTypesWithFourArguments()
+ public void ShouldConcatFourObjectsTogether()
{
var result = ValueStringBuilder.Concat("Test", 1, 2, 3);
@@ -387,7 +395,7 @@ public void ConcatDifferentTypesWithFourArguments()
}
[Fact]
- public void ConcatDifferentTypesWithFiveArguments()
+ public void ShouldConcatFiveObjectsTogether()
{
var result = ValueStringBuilder.Concat("Test", 1, 2, 3, 4);