Click here to Skip to main content
15,887,135 members
Home / Discussions / C#
   

C#

 
AnswerRe: Append to Excel Pin
Wes Aday7-Mar-10 17:58
professionalWes Aday7-Mar-10 17:58 
QuestionInputLanguage Pin
ali_reza_zareian7-Mar-10 4:42
ali_reza_zareian7-Mar-10 4:42 
AnswerRe: InputLanguage Pin
Dan Mos7-Mar-10 4:49
Dan Mos7-Mar-10 4:49 
GeneralRe: InputLanguage Pin
ali_reza_zareian7-Mar-10 4:54
ali_reza_zareian7-Mar-10 4:54 
GeneralRe: InputLanguage Pin
Dan Mos7-Mar-10 5:03
Dan Mos7-Mar-10 5:03 
QuestionC# interface inheritance Pin
Shane55557-Mar-10 3:06
Shane55557-Mar-10 3:06 
AnswerRe: C# interface inheritance Pin
#realJSOP7-Mar-10 3:13
mve#realJSOP7-Mar-10 3:13 
AnswerRe: C# interface inheritance Pin
DaveyM697-Mar-10 3:44
professionalDaveyM697-Mar-10 3:44 
As the string class is sealed you cannot subclass it to force it to implement your interface.
If it's just methods you want to add and you're using 3.5 or 4.0 then you can use extension methods as John suggested.

If you want to add more than methods or are using 2.0 then you will need to create a wrapper around the string class - something like this will get you started
C#
public class SuperString : ISuperString
{
    private string wrappedString;

    public SuperString(string stringToWrap)
    {
        wrappedString = stringToWrap;
    }

    public static implicit operator string(SuperString superString)
    {
        return superString.wrappedString;
    }
    public static implicit operator SuperString(string stringToWrap)
    {
        return new SuperString(stringToWrap);
    }

    public bool containsCapitalLetters()
    {
        throw new NotImplementedException();
    }
}

public interface ISuperString
{
    bool containsCapitalLetters();
}
Dave

Tip: Passing values between objects using events (C#)

BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Why are you using VB6? Do you hate yourself? (Christian Graus)

GeneralRe: C# interface inheritance Pin
harold aptroot7-Mar-10 4:27
harold aptroot7-Mar-10 4:27 
GeneralRe: C# interface inheritance Pin
AspDotNetDev7-Mar-10 5:58
protectorAspDotNetDev7-Mar-10 5:58 
GeneralRe: C# interface inheritance Pin
harold aptroot7-Mar-10 6:24
harold aptroot7-Mar-10 6:24 
AnswerRe: C# interface inheritance Pin
Shane55557-Mar-10 4:08
Shane55557-Mar-10 4:08 
GeneralRe: C# interface inheritance Pin
AspDotNetDev7-Mar-10 4:16
protectorAspDotNetDev7-Mar-10 4:16 
GeneralRe: C# interface inheritance Pin
PIEBALDconsult7-Mar-10 14:24
mvePIEBALDconsult7-Mar-10 14:24 
QuestionOOPs And Debugging Techniques Pin
DotNetMan7-Mar-10 1:21
DotNetMan7-Mar-10 1:21 
AnswerRe: OOPs And Debugging Techniques Pin
dan!sh 7-Mar-10 1:28
professional dan!sh 7-Mar-10 1:28 
AnswerRe: OOPs And Debugging Techniques Pin
AspDotNetDev7-Mar-10 3:00
protectorAspDotNetDev7-Mar-10 3:00 
AnswerRe: OOPs And Debugging Techniques Pin
dybs7-Mar-10 15:22
dybs7-Mar-10 15:22 
AnswerRe: OOPs And Debugging Techniques Pin
N a v a n e e t h7-Mar-10 3:33
N a v a n e e t h7-Mar-10 3:33 
AnswerRe: OOPs And Debugging Techniques Pin
DotNetMan9-Mar-10 1:07
DotNetMan9-Mar-10 1:07 
QuestionPrint Message that is printed in Windows Service Application Pin
Abdul Rahman Hamidy7-Mar-10 0:50
Abdul Rahman Hamidy7-Mar-10 0:50 
AnswerRe: Print Message that is printed in Windows Service Application Pin
dan!sh 7-Mar-10 1:32
professional dan!sh 7-Mar-10 1:32 
GeneralRe: Print Message that is printed in Windows Service Application Pin
Abdul Rahman Hamidy7-Mar-10 17:24
Abdul Rahman Hamidy7-Mar-10 17:24 
QuestionAssembling bytes to an image Pin
Wamuti6-Mar-10 23:18
Wamuti6-Mar-10 23:18 
AnswerRe: Assembling bytes to an image Pin
OriginalGriff6-Mar-10 23:48
mveOriginalGriff6-Mar-10 23:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.