Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET function Phone , +
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}");
       }
 
   }
Posted 17-Oct-12 18:53pm
Edited 17-Oct-12 20:19pm
v4
Comments
Sergey Alexandrovich Kryukov at 18-Oct-12 0:04am
   
What is broken? MSDN? Google? Bing?..
--SA
Sushil Mate at 18-Oct-12 0:16am
   
ohh come on.. spelling mistake? huh..
Sergey Alexandrovich Kryukov at 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...
--SA

1 solution

Rate this: bad
good
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:
http://msdn.microsoft.com/en-us/library/system.string.substring.aspx[^].
 
Please, no offense: what you really need to learn is this: Microsoft Q209354.
 
—SA
  Permalink  
Comments
Sushil Mate at 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..
Sergey Alexandrovich Kryukov at 18-Oct-12 0:36am
   
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,
--SA
sinhasourabh at 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 at 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.
--SA

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

  Print Answers RSS
0 OriginalGriff 5,170
1 DamithSL 4,357
2 Maciej Los 3,750
3 Kornfeld Eliyahu Peter 3,470
4 Sergey Alexandrovich Kryukov 2,851


Advertise | Privacy | Mobile
Web03 | 2.8.141216.1 | Last Updated 18 Oct 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

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