C++ STL string is implemented by template.
I am learing C# at the moment, just curious what’s the reason the .net designers didn’t provide a generic string in System.Collections.Generic?
How can I have a int’s string, double’s string in C#?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There are no such things as strings of
ints ordoubles in C#*; the closest thing is aList<T>, but it does not support the typical string-specific operations, such as substrings, trimming, and so on.You can do most of the things that you can with a string using .NET’s LINQ. For example,
substring(1,5)would belist.Skip(1).Take(5).ToList().* The same is true for C++: there is
basic_stringtemplate that can be instantiated with other types, butstd::stringis an instance of a template class, not a template class itself.