Click here to Skip to main content
15,894,825 members
Home / Discussions / C#
   

C#

 
AnswerRe: Size of attachments to mail send? Pin
N a v a n e e t h23-Jul-08 19:35
N a v a n e e t h23-Jul-08 19:35 
GeneralRe: Size of attachments to mail send? Pin
Member 387988123-Jul-08 20:06
Member 387988123-Jul-08 20:06 
GeneralRe: Size of attachments to mail send? Pin
N a v a n e e t h23-Jul-08 20:33
N a v a n e e t h23-Jul-08 20:33 
GeneralRe: Size of attachments to mail send? Pin
Member 387988123-Jul-08 20:44
Member 387988123-Jul-08 20:44 
QuestionError converting Int64 to Int32 and vice versa Pin
JoeRip23-Jul-08 18:45
JoeRip23-Jul-08 18:45 
AnswerRe: Error converting Int64 to Int32 and vice versa Pin
half-life23-Jul-08 19:48
half-life23-Jul-08 19:48 
GeneralRe: Error converting Int64 to Int32 and vice versa Pin
JoeRip23-Jul-08 19:57
JoeRip23-Jul-08 19:57 
AnswerRe: Error converting Int64 to Int32 and vice versa Pin
Robert.C.Cartaino24-Jul-08 8:30
Robert.C.Cartaino24-Jul-08 8:30 
Can you give an example that does not work?
Using your methods, I plugged in some numbers and, round trip, it works just fine (even without changing the types to unsigned).

static void Main(string[] args)
{
    int highID = -1234567890;
    int lowID = 123456789;

    Console.WriteLine("Build 64-bit ID:");
    long longID = Int64FromPersistentIDs(highID, lowID);
    Console.WriteLine("highID: ({0,20})", highID);  // PrintBits(highID, 32);
    Console.WriteLine(" lowID: ({0,20})", lowID); // PrintBits(lowID, 32);
    Console.WriteLine("longID: ({0,20})", longID); // PrintBits(longID, 64);

    Console.WriteLine("\nExtract-32 bit IDs:");
    PersistentIDsFromInt64(longID, ref highID, ref lowID);
    Console.WriteLine("longID: ({0,20})", longID); // PrintBits(longID, 64);
    Console.WriteLine("highID: ({0,20})", highID); // PrintBits(highID, 32);
    Console.WriteLine(" lowID: ({0,20})", lowID); // PrintBits(lowID, 32);
}

public static Int64 Int64FromPersistentIDs(int highID, int lowID)
{
    return (((Int64)highID << 32) + (Int64)lowID);
}

public static void PersistentIDsFromInt64(Int64 longID, ref int highID, ref int lowID)
{
    lowID = (int)(longID & 0xFFFFFFFF);
    highID = (int)((longID >> 32) & 0xFFFFFFFF);
}


Outputs:
Build 64-bit ID:
highID: (         -1234567890)
 lowID: (           123456789)
longID: (-5302428712118268651)

Extract-32 bit IDs:
longID: (-5302428712118268651)
highID: (         -1234567890)
 lowID: (           123456789)

GeneralRe: Error converting Int64 to Int32 and vice versa Pin
JoeRip24-Jul-08 10:44
JoeRip24-Jul-08 10:44 
QuestionCan you get the resualt? help me, please! Pin
sgncdc23-Jul-08 17:56
sgncdc23-Jul-08 17:56 
AnswerRe: Can you get the resualt? help me, please! Pin
half-life23-Jul-08 19:41
half-life23-Jul-08 19:41 
AnswerRe: Can you get the resualt? help me, please! Pin
sgncdc23-Jul-08 20:25
sgncdc23-Jul-08 20:25 
GeneralRe: Can you get the resualt? help me, please! Pin
Guffa23-Jul-08 23:18
Guffa23-Jul-08 23:18 
AnswerRe: Can you get the resualt? help me, please! Pin
Christian Graus23-Jul-08 23:41
protectorChristian Graus23-Jul-08 23:41 
QuestionProblems when I update database from a xml file Pin
dienhuflit23-Jul-08 17:51
dienhuflit23-Jul-08 17:51 
AnswerRe: Problems when I update database from a xml file Pin
half-life23-Jul-08 19:57
half-life23-Jul-08 19:57 
GeneralRe: Problems when I update database from a xml file Pin
dienhuflit24-Jul-08 15:23
dienhuflit24-Jul-08 15:23 
QuestionData storage and Uploading file Pin
Banjo Ayorinde23-Jul-08 17:13
Banjo Ayorinde23-Jul-08 17:13 
AnswerRe: Data storage and Uploading file Pin
half-life23-Jul-08 19:53
half-life23-Jul-08 19:53 
GeneralRe: Data storage and Uploading file Pin
Abdul Sami X24-Jul-08 20:15
Abdul Sami X24-Jul-08 20:15 
QuestionCopy Dictionay Object To Other [modified] Pin
vaibhav.jape@gmail.com23-Jul-08 13:30
vaibhav.jape@gmail.com23-Jul-08 13:30 
AnswerRe: Copy Dictionay Object To Other Pin
N a v a n e e t h23-Jul-08 17:01
N a v a n e e t h23-Jul-08 17:01 
GeneralRe: Copy Dictionay Object To Other Pin
vaibhav.jape@gmail.com23-Jul-08 17:20
vaibhav.jape@gmail.com23-Jul-08 17:20 
AnswerRe: Copy Dictionay Object To Other [modified] Pin
Elroy Dsilva23-Jul-08 17:10
Elroy Dsilva23-Jul-08 17:10 
AnswerRe: Copy Dictionay Object To Other Pin
Elroy Dsilva23-Jul-08 17:37
Elroy Dsilva23-Jul-08 17:37 

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.