Why do I get “cannot be accessed with an instance reference” when using teststring.Join but not teststring.Split? (c#)

前端 未结 6 466
南旧
南旧 2021-01-18 11:44

I\'m learning c# and there is something I do not understand that I\'ve been unable to find any help about online.

string[] = testarray = { \"test1\", \"test2         


        
6条回答
  •  一向
    一向 (楼主)
    2021-01-18 12:23

    I would assume its because the method is not directly related to the String reference in any way and in order to avoid any confusion they made it a static method of String instead, whereas Split is directly related as you're splitting that particular String instance.

提交回复
热议问题