Click here to Skip to main content
13,054,329 members (121,907 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
Hi everyone;
I am trying to do blog project and I am using ado.net and I have 3-tier architecture...
in one of classlibrary I have properties ... such as User and Comments

public class User
 {
     public int userID{ get; set; }
     public string userName{ get; set; }
     public string userPassword { get; set; }
     public string userMail{ get; set; }
}


public class Comments
{
    public int ID { get; set; }
    public int userID{ get; set; }
    public string commentHeader{ get; set; }
    public string commentContent{ get; set; }
}



I want use userName in Comments class.And I decided to create open property in Comment class.
Cause I will show in UI and I dont want to see just userID; better for understanding who sent this comment with userName...How I can create

public string userName
{
    get
    {
       return //(what I have to write here)
    }
}
Posted 24-Sep-12 20:34pm
y.baris677

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

This is one possible option:
private string m_strUserName;
public string userName
{
  get
  {
    return m_strUserName;
  }
}
  Permalink  
Comments
y.baris 25-Sep-12 7:50am
   
can you explain a little please...how can I reach information of user which I only know about his ID.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 25 Sep 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100