Click here to Skip to main content
15,902,275 members
Home / Discussions / C#
   

C#

 
AnswerRe: Pass an argument to use with a foreach loop Pin
OriginalGriff11-May-10 0:31
mveOriginalGriff11-May-10 0:31 
GeneralRe: Pass an argument to use with a foreach loop Pin
Mc_Topaz11-May-10 0:55
Mc_Topaz11-May-10 0:55 
AnswerRe: Pass an argument to use with a foreach loop Pin
Abhinav S11-May-10 0:47
Abhinav S11-May-10 0:47 
AnswerRe: Pass an argument to use with a foreach loop Pin
sam#11-May-10 0:57
sam#11-May-10 0:57 
AnswerRe: Pass an argument to use with a foreach loop Pin
Luc Pattyn11-May-10 2:20
sitebuilderLuc Pattyn11-May-10 2:20 
Questiongetting ini value Pin
Member 59031010-May-10 22:27
Member 59031010-May-10 22:27 
AnswerRe: getting ini value Pin
OriginalGriff10-May-10 22:49
mveOriginalGriff10-May-10 22:49 
AnswerRe: getting ini value Pin
PIEBALDconsult11-May-10 3:38
mvePIEBALDconsult11-May-10 3:38 
Whenever I use P/Invoke I write a method to wrap the API method:

[
    System.Runtime.InteropServices.DllImportAttribute
    (
        "Kernel32"
    ,
        SetLastError=true
    ,
        EntryPoint="GetPrivateProfileString"
    )
]
private unsafe static extern uint
API_GetPrivateProfileString
(
    string lpAppName
,
    string lpKeyName
,
    string lpDefault
,
    byte*  lpReturnedString
,
    int    nSize
,
    string lpFileName
) ;

public unsafe static int
GetPrivateProfileString
(
    string     lpAppName
,
    string     lpKeyName
,
    string     lpDefault
,
    out string lpReturnedString
,
    int        nSize
,
    string     lpFileName
)
{
    int    result ;
    byte[] temp   = new byte [ nSize ] ;

    fixed ( byte* ptemp = temp )
    {
        result = (int) API_GetPrivateProfileString
        (
            lpAppName
        ,
            lpKeyName
        ,
            lpDefault
        ,
            ptemp
        ,
            nSize
        ,
            lpFileName
        ) ;
    }

    lpReturnedString = System.Text.Encoding.Unicode.GetString ( temp ).Substring ( 0 , result ) ;

    return ( result ) ;
}



I wrote this for someone else when I was just learning C#, I don't use it. I use XML for configuration files.
QuestionSending data through SOAP Pin
Priya Prk10-May-10 21:49
Priya Prk10-May-10 21:49 
AnswerRe: Sending data through SOAP Pin
Abhinav S10-May-10 22:33
Abhinav S10-May-10 22:33 
QuestionPrint Visitor Card Pin
Hakmeh Mohannad10-May-10 21:49
Hakmeh Mohannad10-May-10 21:49 
Questionvss and visual studio Pin
Zeyad Jalil10-May-10 21:23
professionalZeyad Jalil10-May-10 21:23 
AnswerRe: vss and visual studio Pin
R. Giskard Reventlov10-May-10 21:27
R. Giskard Reventlov10-May-10 21:27 
AnswerRe: vss and visual studio Pin
Abhinav S10-May-10 21:28
Abhinav S10-May-10 21:28 
GeneralRe: vss and visual studio Pin
Zeyad Jalil10-May-10 22:27
professionalZeyad Jalil10-May-10 22:27 
AnswerRe: vss and visual studio Pin
Michel Godfroid10-May-10 22:49
Michel Godfroid10-May-10 22:49 
GeneralRe: vss and visual studio Pin
Zeyad Jalil10-May-10 23:00
professionalZeyad Jalil10-May-10 23:00 
GeneralRe: vss and visual studio Pin
Michel Godfroid10-May-10 23:04
Michel Godfroid10-May-10 23:04 
GeneralRe: vss and visual studio Pin
Zeyad Jalil10-May-10 23:26
professionalZeyad Jalil10-May-10 23:26 
GeneralRe: vss and visual studio Pin
Michel Godfroid10-May-10 23:40
Michel Godfroid10-May-10 23:40 
GeneralRe: vss and visual studio Pin
Zeyad Jalil11-May-10 0:11
professionalZeyad Jalil11-May-10 0:11 
GeneralRe: vss and visual studio Pin
Michel Godfroid11-May-10 0:44
Michel Godfroid11-May-10 0:44 
QuestionGetting IP Address in C# Pin
Beulshere10-May-10 20:03
Beulshere10-May-10 20:03 
AnswerRe: Getting IP Address in C# Pin
Peace ON10-May-10 20:29
Peace ON10-May-10 20:29 
QuestionRe: Getting IP Address in C# Pin
Michel Godfroid10-May-10 20:39
Michel Godfroid10-May-10 20:39 

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.