locked
Getting a class variable RRS feed

  • Question

  • User713846025 posted

    Hello,

    i got 2 class:

    public class Store{
    public int Id { get; set; }
    public String Name { get; set; }
    public virtual List<Article> Articles { get; set; }
    }
    
    public class Article{
    public int Id { get; set; }
    public string Name { get; set; }
    public float Price { get; set; }
    public virtual Store Store { get; set; }
    }

    I got an instance X of article:

    How could I get the store id of the article X?

    i tried X.Store.Id it doesnt work, should i call a static variable? or should i create a method GetStoreId()?

    Saturday, August 4, 2018 7:40 PM

Answers

  • User713846025 posted

    Problem Resolved !

    This works just fine, got another problem somewhere else.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, August 4, 2018 9:33 PM