none
Access object properties by name's string RRS feed

  • Question

  • Hello !

    I'm using Entity Framework 6.

    I'm trying to implement a general functions that do some actions with object and its properties.

    This is my general code :

    Dim varobject Dim Naviprop as list(of String) ....... ...... nvaiprop.add("Child1") varobject=MyObject dim c as integer
    c=CallByName(varobject,list(0),CallType.Get)).Count


    This code is working and variable c get the number of object in Child1 collection of MyObject.

    But another expression that I want to use is not working with this method :

    Dim item
    item=CallByName(varobject,list(0),CallType.Get)).ElementAt(1)

    This expression return an error :

    Public member 'ElementAt' on type 'HashSet(Of Child1)' not found

    What can I do ?

    Thank you !

    Wednesday, April 15, 2015 4:51 AM

All replies

  • >>This code is working and variable c get the number of object in Child1 collection of MyObject.

    Yes, it works and it does not work for your another expression, so what it is and what you want us to do for you.

    >>Public member 'ElementAt' on type 'HashSet(Of Child1)' not found

    This exception is very common, you gets a lot of information if you searched by using your favorite search tool.


    Thursday, April 16, 2015 6:08 AM
  • What I want from you, is that if possible  to explain why the CallByName does not work in the second case , and what can I do to resolve the problem.

    and if you know that for this error I can find solution using search tool , maybe you read it before of me and know the response.

    For what i'm asking here , if someone know the response.

    • Edited by dcode25 Friday, April 17, 2015 12:08 AM
    Friday, April 17, 2015 12:06 AM
  • >>What I want from you, is that if possible  to explain why the CallByName does not work in the second case , and what can I do to resolve the problem.

    So what is the CallByName method? Is it an your custom method or something else? How can people help you with only knowing a method name and seems to be a yourself one?

    Friday, April 17, 2015 5:59 AM
  • Friday, April 17, 2015 2:49 PM
  • Hello dcode25,

    >> I'm using Entity Framework 6.

    From your description and provided code, I am confused why this issue is related with Entity Framework, from your code, I do not see which part belongs to EF and causes this issue due to EF. Could you please provide a clear clarification for this issue? Currently, this issue should be related with the VB.NET function, I suggest you could ask it on VB.NET forum:

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=vbgeneral

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, April 20, 2015 1:09 PM
    Moderator