CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2012
    Posts
    8

    Adding string to a instace

    Hi All,

    I have something like this..
    "[ c o d e ]"

    public class Student : ObservableObject
    {
    public string StudentName { get; set; }
    public string StudentType { get; set; }
    public string Section { get; set; }
    public double Number { get; set; }
    public string School { get; set; }
    public object this[string key] { get; set; }
    public bool ContainsKey(string key);
    public Dictionary<string, object> GettingDictionary();


    }

    "[ / c o d e ]"



    I am creating a instace for the list of students
    List<Student> localcontext = new List<Student>();

    I want to add one more string "StudentLocation" from the instance 'localcontext' to the Student object in some other place.


    Can somebody help me on this?

    Thanks,
    Genith

  2. #2
    Join Date
    Jun 2007
    Posts
    12

    Re: Adding string to a instace

    If not every student has a location, why don't you just allow that property to be nullable, or have a default value?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured