Click here to Skip to main content
14,447,105 members
Rate this:
Please Sign up or sign in to vote.
try to use the following method to pass the format to my phone number,butis not work
can anybody explain

the error i have is

'string' does not contain a definition for 'substring' and no extension method 'substring' accepting a first argument of type 'string' could be found (are you missing a using directive or an assembly reference?)

the model
public class ViewModel


       private string formatPhoneNumber(string phone)

           //should return (123)456-7890
           return string.Format("({0})-{1}-{2}");

Updated 17-Oct-12 20:19pm
What is broken? MSDN? Google? Bing?..
Sushil Mate 18-Oct-12 0:16am
ohh come on.. spelling mistake? huh..
Sergey Alexandrovich Kryukov 18-Oct-12 13:50pm
Spelling is mere politeness when writing to people. To a compiler... poor spelling is just a waste of CPU cycles...

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Something is fundamentally wrong with your approach to work in general. Was it so difficult to look at the MSDN help page and see the right spelling? Well, take a look now:[^].

Please, no offense: what you really need to learn is this: Microsoft Q209354.

Sushil Mate 18-Oct-12 0:27am
quite offensive link there :)
I don't know, day by day OP's level decreasing... one day you will wake up
& you ll find something weird like this..god only knows what they will ask..
Not for the first time... really deserved, anyway.
Yes, this is sad. It makes less and less sense. But some question really deserve the effort. Maybe, we should delete 99%, to support reputation of the forum.

Thank you,
[no name] 18-Oct-12 1:37am
Agreed with Kryukov.
People are expecting that we will do google for them. We should vote/downvote each question to maintain the reputation of the forum.
Sergey Alexandrovich Kryukov 18-Oct-12 13:48pm
Thank you for your understanding and support. I also think that the absolute majority of posts should be eventually deleted when not answered and the inquirer shows no collaborative activity during certain period of time. An inquirer should be given a chance, but many don't bother replying if members ask to clarify question. Such posts have only negative impact: people just searching of available answers get more an more trash instead of answers. This is about reputation of the forum, yes.

I advise all members to actively remove hopeless question posts, their own and someone's else. The mistake here won't be vital: if OP really cares, she/he will post again, in improved way.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100