On Jun 25, 4:44*pm, shapper <mdmo...@gmail.com> wrote:
> On Jun 25, 4:23*pm, "Jon Skeet [C# MVP]" <sk...@pobox.com> wrote:
>
>
>
> > On Jun 25, 4:14*pm, shapper <mdmo...@gmail.com> wrote:
>
> > > I have the following classes:
>
> > > namespace MyApp.Models {
> > > * public class Tie {
> > > * * public Count Count { get; set; }
> > > * * public Tie() {
> > > * * * this.Count = new Count();
> > > * * }
> > > * }}
>
> > > namespace MyApp.Models
> > > {
> > > * public class Count
> > > * {
> > > * * public int File { get; set; }
> > > * * public int Professor { get; set; }
> > > * }
>
> > > }
>
> > > However, when I access the Tie class in my code the only think Visual
> > > Studio recognizes is:
> > > Tie.Tie.Tie ...
>
> > > Why can't I access Tie.Count ?
>
> > Count is an instance property - so you should be able to do:
>
> > Tie someTie = new Tie();
> > Count count = someTie.Count;
>
> > But you can't do:
>
> > Count count = Tie.Count;
>
> > Jon
>
> I am trying to do the following:
>
> * * * data.TagPapers = (from t in
> database.Tags
> * * * * * * * * * * * * * * * * * select new TagPaper {
> * * * * * * * * * * * * * * * * * * Tag = t,
> * * * * * * * * * * * * * * * * * * Tie.Count.File =
> t.FileTag.Count
> * * * * * * * * * * * * * * * * *}).ToList
>
> Where TagPapers is a List of TagPaper which is a class with 2
> properties: Tag and Tie.
>
> Shouldn't this be working?
>
> It is not working on Tie.Count.File
>
> I have no idea what is wrong. It seems right to me.
>
> Any idea?
>
> Thanks,
> Miguel
Sloan,
But since, I think, NET 3.0 there are automatic properties so you
don't need all those variables:
http://weblogs.asp.net/scottgu/archi...tializers.aspx
That was what I was doing.
Thanks,
Miguel