Click here to Skip to main content
15,898,035 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: How to extend a generic type like KeyValuePair(of TKey, TValue)? Pin
Jon_Boy13-Feb-09 6:30
Jon_Boy13-Feb-09 6:30 
GeneralRe: How to extend a generic type like KeyValuePair(of TKey, TValue)? Pin
Scott Dorman13-Feb-09 9:30
professionalScott Dorman13-Feb-09 9:30 
GeneralRe: How to extend a generic type like KeyValuePair(of TKey, TValue)? Pin
Jon_Boy16-Feb-09 6:14
Jon_Boy16-Feb-09 6:14 
QuestionEvents Pin
CodingYoshi13-Feb-09 4:34
CodingYoshi13-Feb-09 4:34 
AnswerRe: Events Pin
Dave Kreskowiak13-Feb-09 4:43
mveDave Kreskowiak13-Feb-09 4:43 
GeneralRe: Events Pin
CodingYoshi13-Feb-09 8:09
CodingYoshi13-Feb-09 8:09 
GeneralRe: Events Pin
Dave Kreskowiak13-Feb-09 9:37
mveDave Kreskowiak13-Feb-09 9:37 
QuestionReflection with local variables Pin
Clay Walnum13-Feb-09 3:30
Clay Walnum13-Feb-09 3:30 
Hello, all.

Is it possible to get the name of a local variable from a reference to the variable? For example, I can get the names and values of a calling function's parameters like this:
Dim frame As New StackFrame(1)
Dim pInfos() As ParameterInfo = frame.GetMethod().GetParameters()

Is there some way to get the same information for a calling function's local variables? This is kind of what I have in mind:
Sub SomeSub()
    Dim count As Integer = 10
    Dim average As Single = 45.67
    LogLocalVariables(count, average)
End Sub
Sub LogLocalVariables(ByVal var1 As Object, ByVal var2 As Object)
    ' I can get each variable's type like this:
    Dim mBody As MethodBody = GetType(Form1).GetMethod _
        ("SomeSub").GetMethodBody()
    Dim varList As ObjectModel.ReadOnlyCollection(Of LocalVariableInfo) = _
        mBody.LocalVariables

    ' But what I really want is info like this:
    '     count = 10
    '     average = 45.67
End Sub

Thanks.

--Clay
GeneralRe: Reflection with local variables Pin
Luc Pattyn13-Feb-09 4:45
sitebuilderLuc Pattyn13-Feb-09 4:45 
GeneralRe: Reflection with local variables Pin
Clay Walnum13-Feb-09 5:39
Clay Walnum13-Feb-09 5:39 
GeneralRe: Reflection with local variables Pin
Gideon Engelberth13-Feb-09 6:25
Gideon Engelberth13-Feb-09 6:25 
AnswerRe: Reflection with local variables Pin
Dave Kreskowiak13-Feb-09 5:06
mveDave Kreskowiak13-Feb-09 5:06 
GeneralRe: Reflection with local variables Pin
Clay Walnum13-Feb-09 5:48
Clay Walnum13-Feb-09 5:48 
GeneralRe: Reflection with local variables Pin
Luc Pattyn13-Feb-09 6:07
sitebuilderLuc Pattyn13-Feb-09 6:07 
AnswerRe: Reflection with local variables Pin
Guffa13-Feb-09 19:10
Guffa13-Feb-09 19:10 
GeneralRe: Reflection with local variables Pin
Clay Walnum16-Feb-09 2:17
Clay Walnum16-Feb-09 2:17 
AnswerRe: Reflection with local variables Pin
Samir Ibrahim15-Feb-09 14:17
Samir Ibrahim15-Feb-09 14:17 
GeneralRe: Reflection with local variables Pin
Clay Walnum16-Feb-09 2:26
Clay Walnum16-Feb-09 2:26 
GeneralRe: Reflection with local variables Pin
Samir Ibrahim16-Feb-09 4:36
Samir Ibrahim16-Feb-09 4:36 
QuestionDeleting all datas from Combo Box Pin
jishbalan13-Feb-09 1:11
jishbalan13-Feb-09 1:11 
AnswerRe: Deleting all datas from Combo Box Pin
Rupesh Kumar Swami13-Feb-09 1:43
Rupesh Kumar Swami13-Feb-09 1:43 
GeneralRe: Deleting all datas from Combo Box Pin
jishbalan13-Feb-09 1:52
jishbalan13-Feb-09 1:52 
GeneralRe: Deleting all datas from Combo Box Pin
EliottA13-Feb-09 2:21
EliottA13-Feb-09 2:21 
GeneralRe: Deleting all datas from Combo Box Pin
jishbalan13-Feb-09 2:58
jishbalan13-Feb-09 2:58 
GeneralRe: Deleting all datas from Combo Box Pin
EliottA13-Feb-09 3:10
EliottA13-Feb-09 3:10 

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.