Click here to Skip to main content
15,912,665 members
Home / Discussions / C#
   

C#

 
Questioncalling unmanaged C++ dll from C#: return type double[] Pin
devvvy28-Jul-09 22:27
devvvy28-Jul-09 22:27 
AnswerRe: calling unmanaged C++ dll from C#: return type double[] Pin
Moreno Airoldi29-Jul-09 3:13
Moreno Airoldi29-Jul-09 3:13 
QuestionDownload a intranet site from a windows form (401 error) Pin
Succodimele28-Jul-09 22:14
Succodimele28-Jul-09 22:14 
AnswerRe: Download a intranet site from a windows form (401 error) Pin
Vimalsoft(Pty) Ltd29-Jul-09 2:03
professionalVimalsoft(Pty) Ltd29-Jul-09 2:03 
GeneralRe: Download a intranet site from a windows form (401 error) Pin
Succodimele29-Jul-09 4:11
Succodimele29-Jul-09 4:11 
GeneralRe: Download a intranet site from a windows form (401 error) Pin
Vimalsoft(Pty) Ltd29-Jul-09 4:34
professionalVimalsoft(Pty) Ltd29-Jul-09 4:34 
GeneralRe: Download a intranet site from a windows form (401 error) Pin
Succodimele29-Jul-09 19:56
Succodimele29-Jul-09 19:56 
GeneralRe: Download a intranet site from a windows form (401 error) Pin
Succodimele29-Jul-09 20:15
Succodimele29-Jul-09 20:15 
QuestionHow do I get the correct font height in Hindi fonts? Pin
Gywox28-Jul-09 22:05
Gywox28-Jul-09 22:05 
AnswerRe: How do I get the correct font height in Hindi fonts? Pin
Nagy Vilmos28-Jul-09 22:19
professionalNagy Vilmos28-Jul-09 22:19 
GeneralRe: How do I get the correct font height in Hindi fonts? Pin
Gywox28-Jul-09 22:30
Gywox28-Jul-09 22:30 
GeneralRe: How do I get the correct font height in Hindi fonts? Pin
Nagy Vilmos28-Jul-09 23:10
professionalNagy Vilmos28-Jul-09 23:10 
GeneralRe: How do I get the correct font height in Hindi fonts? Pin
Gywox28-Jul-09 23:20
Gywox28-Jul-09 23:20 
Questionhorizontal scroll bar move event... Pin
spalanivel28-Jul-09 21:21
spalanivel28-Jul-09 21:21 
AnswerRe: horizontal scroll bar move event... Pin
stancrm28-Jul-09 21:43
stancrm28-Jul-09 21:43 
GeneralRe: horizontal scroll bar move event... Pin
spalanivel28-Jul-09 22:00
spalanivel28-Jul-09 22:00 
GeneralRe: horizontal scroll bar move event... Pin
spalanivel29-Jul-09 0:53
spalanivel29-Jul-09 0:53 
AnswerRe: horizontal scroll bar move event... Pin
Alan N29-Jul-09 2:03
Alan N29-Jul-09 2:03 
QuestionOOP approach, static method Pin
Raybarg28-Jul-09 20:46
professionalRaybarg28-Jul-09 20:46 
AnswerRe: OOP approach, static method Pin
Christian Graus28-Jul-09 21:00
protectorChristian Graus28-Jul-09 21:00 
AnswerRe: OOP approach, static method Pin
DaveyM6928-Jul-09 22:41
professionalDaveyM6928-Jul-09 22:41 
GeneralRe: OOP approach, static method Pin
Raybarg28-Jul-09 23:04
professionalRaybarg28-Jul-09 23:04 
GeneralRe: OOP approach, static method Pin
DaveyM6928-Jul-09 23:39
professionalDaveyM6928-Jul-09 23:39 
It depends - not very helpful I know!

If they need array elemement level access then probably yes.

Imagine if your document was basically a header, body and footer - all strings. Something like this would be a good way of exposing it.
public class TheDocument
{
    private string[] theData = new string[3];

    public TheDocument()
        : this(new string[] { string.Empty, string.Empty, string.Empty })
    { }
    public TheDocument(string body)
        : this(new string[] { string.Empty, body, string.Empty })
    { }
    public TheDocument(string header, string body)
        : this(new string[] { header, body, string.Empty })
    { }
    public TheDocument(string header, string body, string footer)
        : this(new string[] { header, body, footer })
    { }
    // This constructor is used by all constructors
    private TheDocument(string[] data)
    {
        if (data.Length == 3)
            theData = data;
        else
            throw new ArgumentOutOfRangeException("data", "Data must have a length of 3");
    }

    public static implicit operator TheDocument(string[] data)
    {
        return new TheDocument(data);
    }
    public static implicit operator string[](TheDocument theDocument)
    {
        return theDocument.theData;
    }

    public string Header
    {
        get { return theData[0]; }
        set { theData[0] = value; }
    }
    public string Body
    {
        get { return theData[1]; }
        set { theData[1] = value; }
    }
    public string Footer
    {
        get { return theData[2]; }
        set { theData[2] = value; }
    }

    public void Print()
    {
        PrintTheDocument(this);
    }
    // This method handles all the printing
    public static void PrintTheDocument(TheDocument theDocument)
    {
        // ...
    }
}


Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
Why are you using VB6? Do you hate yourself? (Christian Graus)

AnswerRe: OOP approach, static method Pin
PIEBALDconsult29-Jul-09 4:58
mvePIEBALDconsult29-Jul-09 4:58 
QuestionAttach User Entered Data with word Document while saving Pin
mandar77728-Jul-09 20:41
mandar77728-Jul-09 20:41 

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.