Click here to Skip to main content
15,891,033 members
Home / Discussions / C#
   

C#

 
AnswerRe: Beginner question. How do I create this? Simple data entry Pin
Member 1082060315-May-14 3:14
Member 1082060315-May-14 3:14 
QuestionHow to capture Skype voice communication by C# program using win32 function Pin
Tridip Bhattacharjee29-Apr-14 4:09
professionalTridip Bhattacharjee29-Apr-14 4:09 
AnswerRe: How to capture Skype voice communication by C# program using win32 function Pin
Pete O'Hanlon29-Apr-14 4:23
mvePete O'Hanlon29-Apr-14 4:23 
GeneralRe: How to capture Skype voice communication by C# program using win32 function Pin
Tridip Bhattacharjee29-Apr-14 20:58
professionalTridip Bhattacharjee29-Apr-14 20:58 
GeneralRe: How to capture Skype voice communication by C# program using win32 function Pin
Pete O'Hanlon29-Apr-14 21:38
mvePete O'Hanlon29-Apr-14 21:38 
GeneralRe: How to capture Skype voice communication by C# program using win32 function Pin
Tridip Bhattacharjee30-Apr-14 4:26
professionalTridip Bhattacharjee30-Apr-14 4:26 
QuestionA Query regarding Nullable types in C# PinPopular
Agent__00728-Apr-14 20:24
professionalAgent__00728-Apr-14 20:24 
AnswerRe: A Query regarding Nullable types in C# Pin
OriginalGriff28-Apr-14 20:47
mveOriginalGriff28-Apr-14 20:47 
This gets complex...Laugh | :laugh:

ToString is overridden, as you say - it has to be, because a nullable type "encapsulates" the ValueType it holds, and if it wasn't then it would never work!
So when you call ToString on the tmp variable, it checks the type of variable - Nullable<int> - and calls the Nullable<T> version of ToString, without worrying about the content:
IL_002a:  ldloca.s   tmp
IL_002c:  constrained. valuetype [mscorlib]System.Nullable`1<int32>
IL_0032:  callvirt   instance string [mscorlib]System.Object::ToString()
IL_0037:  call       void [mscorlib]System.Console::WriteLine(string)

But...GetType isn't overridden - which means that the default object version must be called, which takes a Reference parameter, not a Value type. Which means that the Nullable<T> value type needs to be boxed to convert it, and it's the boxing operation that throws the NullReferenceException, not the GetType call:
IL_003d:  ldloc.0
IL_003e:  box        valuetype [mscorlib]System.Nullable`1<int32>
IL_0043:  callvirt   instance class [mscorlib]System.Type [mscorlib]System.Object::GetType()
IL_0048:  call       void [mscorlib]System.Console::WriteLine(object)

Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)

GeneralRe: A Query regarding Nullable types in C# Pin
Rob Philpott28-Apr-14 23:30
Rob Philpott28-Apr-14 23:30 
AnswerRe: A Query regarding Nullable types in C# Pin
Kornfeld Eliyahu Peter28-Apr-14 20:54
professionalKornfeld Eliyahu Peter28-Apr-14 20:54 
GeneralRe: A Query regarding Nullable types in C# Pin
Agent__00728-Apr-14 21:03
professionalAgent__00728-Apr-14 21:03 
GeneralRe: A Query regarding Nullable types in C# Pin
OriginalGriff28-Apr-14 21:15
mveOriginalGriff28-Apr-14 21:15 
GeneralRe: A Query regarding Nullable types in C# Pin
Agent__00728-Apr-14 21:27
professionalAgent__00728-Apr-14 21:27 
AnswerRe: A Query regarding Nullable types in C# Pin
Rob Philpott28-Apr-14 23:28
Rob Philpott28-Apr-14 23:28 
GeneralRe: A Query regarding Nullable types in C# Pin
Agent__00728-Apr-14 23:50
professionalAgent__00728-Apr-14 23:50 
QuestionC# webcam video recording Please Help me! Pin
Member 1078092828-Apr-14 7:44
Member 1078092828-Apr-14 7:44 
AnswerRe: C# webcam video recording Please Help me! Pin
OriginalGriff28-Apr-14 8:05
mveOriginalGriff28-Apr-14 8:05 
Question"Attempted to divide by zero" Exception occuring in "Audio Steganography" in c# Pin
Member 1059173628-Apr-14 7:22
Member 1059173628-Apr-14 7:22 
AnswerRe: "Attempted to divide by zero" Exception occuring in "Audio Steganography" in c# Pin
OriginalGriff28-Apr-14 8:02
mveOriginalGriff28-Apr-14 8:02 
GeneralRe: "Attempted to divide by zero" Exception occuring in "Audio Steganography" in c# Pin
Member 1059173628-Apr-14 9:11
Member 1059173628-Apr-14 9:11 
AnswerRe: "Attempted to divide by zero" Exception occuring in "Audio Steganography" in c# Pin
OriginalGriff28-Apr-14 9:28
mveOriginalGriff28-Apr-14 9:28 
GeneralRe: "Attempted to divide by zero" Exception occuring in "Audio Steganography" in c# Pin
Member 1059173628-Apr-14 20:46
Member 1059173628-Apr-14 20:46 
GeneralRe: "Attempted to divide by zero" Exception occuring in "Audio Steganography" in c# Pin
OriginalGriff28-Apr-14 21:12
mveOriginalGriff28-Apr-14 21:12 
GeneralRe: "Attempted to divide by zero" Exception occuring in "Audio Steganography" in c# Pin
Dave Kreskowiak28-Apr-14 9:31
mveDave Kreskowiak28-Apr-14 9:31 
GeneralRe: "Attempted to divide by zero" Exception occuring in "Audio Steganography" in c# Pin
Pete O'Hanlon29-Apr-14 0:29
mvePete O'Hanlon29-Apr-14 0:29 

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.