Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ Concat() [6/12]

static string System.String.Concat ( params string?[] values)
inlinestatic

Definition at line 1834 of file String.cs.

1835 {
1836 if (values == null)
1837 {
1838 throw new ArgumentNullException("values");
1839 }
1840 if (values.Length <= 1)
1841 {
1842 object obj;
1843 if (values.Length != 0)
1844 {
1845 obj = values[0];
1846 if (obj == null)
1847 {
1848 return Empty;
1849 }
1850 }
1851 else
1852 {
1853 obj = Empty;
1854 }
1855 return (string)obj;
1856 }
1857 long num = 0L;
1858 foreach (string text in values)
1859 {
1860 if ((object)text != null)
1861 {
1862 num += text.Length;
1863 }
1864 }
1865 if (num > int.MaxValue)
1866 {
1867 throw new OutOfMemoryException();
1868 }
1869 int num2 = (int)num;
1870 if (num2 == 0)
1871 {
1872 return Empty;
1873 }
1874 string text2 = FastAllocateString(num2);
1875 int num3 = 0;
1876 foreach (string text3 in values)
1877 {
1878 if (!IsNullOrEmpty(text3))
1879 {
1880 int length = text3.Length;
1881 if (length > num2 - num3)
1882 {
1883 num3 = -1;
1884 break;
1885 }
1887 num3 += length;
1888 }
1889 }
1890 if (num3 != num2)
1891 {
1892 return Concat((string[])values.Clone());
1893 }
1894 return text2;
1895 }
static readonly string Empty
Definition String.cs:29
static void FillStringChecked(string dest, int destPos, string src)
Definition String.cs:1560
static string FastAllocateString(int length)
static bool IsNullOrEmpty([NotNullWhen(false)] string? value)
Definition String.cs:1319
static string Concat(object? arg0)
Definition String.cs:1569

References System.String.Concat(), System.String.Empty, System.String.FastAllocateString(), System.String.FillStringChecked(), System.String.IsNullOrEmpty(), System.L, System.length, System.obj, System.text, and System.values.