Click here to Skip to main content
16,009,114 members
Home / Discussions / C#
   

C#

 
AnswerRe: Timeout expired Pin
Dave Kreskowiak12-Oct-09 8:25
mveDave Kreskowiak12-Oct-09 8:25 
QuestionChanging Folder Permission using C# Pin
MikeSharp11-Oct-09 18:21
MikeSharp11-Oct-09 18:21 
QuestionList of classes as a property of a class Pin
Protus11-Oct-09 16:06
Protus11-Oct-09 16:06 
I want to have a class name Faculty with some memeber properties. One of the property is a (list of student classes) List<myStudent>. I have a student class (as given below).

When I compile I get the following error:

"Inconsistent accessibility: parameter type 'NestedClass.myStudent' is less accessible than method 'NestedClass.myFacultyMember.AddMyNewItem"

What am I doing wrong?
Cannot we access user defined data types (in this case a class object) within a class from outside?

Thank you in advance!

------------student class-----------------------
<using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NestedClass
{
class myStudent
{
private int studentID;
private string firstName;
private string lastName;
private int age;

public myStudent()
{
}
~myStudent()
{
}

public int StudentID
{
get
{
return studentID;
}
set
{
studentID = value;
}
}
public string FirstName
{
get
{
return firstName;
}
set
{
firstName = value;
}
}
public string LastName
{
get
{
return lastname;
}
set
{
lastname = value;
}
}
public int Age
{
get
{
return age;
}
set
{
age = value;
}
}
}
}

----------- Faculty Class ---------------------

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NestedClass
{
public class myFacultyMember
{
private int facultyID;
private string firstName;
private string lastName;
private int age;

private List<myStudent> lst_Students = new List<myStudent>();

public myFacultyMember()
{
}
~myFacultyMember()
{
}

public int FacultyID
{
get
{
return facultyID;
}
set
{
facultyID = value;
}
}
public string FirstName
{
get
{
return firstName;
}
set
{
firstName = value;
}
}
public string LastName
{
get
{
return lastName;
}
set
{
lastName = value;
}
}
public int Age
{
get
{
return age;
}
set
{
age = value;
}
}

public void AddMyNewItem(myStudent newItem)
{
lst_Students.Add(newItem);
}
}
}>
AnswerRe: List of classes as a property of a class Pin
N a v a n e e t h11-Oct-09 17:00
N a v a n e e t h11-Oct-09 17:00 
QuestionStreamReader -&gt; StreamWriter... file comes out much bigger !! Pin
je198011-Oct-09 8:56
je198011-Oct-09 8:56 
AnswerRe: StreamReader -&gt; StreamWriter... file comes out much bigger !! Pin
harold aptroot11-Oct-09 8:59
harold aptroot11-Oct-09 8:59 
AnswerRe: StreamReader -&gt; StreamWriter... file comes out much bigger !! [modified] Pin
Jaime Olivares11-Oct-09 18:47
Jaime Olivares11-Oct-09 18:47 
GeneralRe: StreamReader -&gt; StreamWriter... file comes out much bigger !! Pin
riced12-Oct-09 6:13
riced12-Oct-09 6:13 
GeneralRe: StreamReader -&gt; StreamWriter... file comes out much bigger !! Pin
Jaime Olivares12-Oct-09 6:40
Jaime Olivares12-Oct-09 6:40 
GeneralRe: StreamReader -&gt; StreamWriter... file comes out much bigger !! Pin
riced12-Oct-09 6:56
riced12-Oct-09 6:56 
GeneralRe: StreamReader -&gt; StreamWriter... file comes out much bigger !! Pin
Jaime Olivares12-Oct-09 7:39
Jaime Olivares12-Oct-09 7:39 
Questionextract files with the filestream Pin
nhqlbaislwfiikqraqnm11-Oct-09 8:15
nhqlbaislwfiikqraqnm11-Oct-09 8:15 
AnswerRe: extract files with the filestream Pin
Christian Graus11-Oct-09 10:27
protectorChristian Graus11-Oct-09 10:27 
Questiondll loading? Pin
nhqlbaislwfiikqraqnm1-Apr-21 23:29
nhqlbaislwfiikqraqnm1-Apr-21 23:29 
AnswerRe: dll loading? Pin
Richard MacCutchan11-Oct-09 8:45
mveRichard MacCutchan11-Oct-09 8:45 
GeneralRe: dll loading? Pin
Not Active11-Oct-09 8:53
mentorNot Active11-Oct-09 8:53 
GeneralRe: dll loading? Pin
Richard MacCutchan11-Oct-09 9:29
mveRichard MacCutchan11-Oct-09 9:29 
AnswerRe: dll loading? Pin
Not Active11-Oct-09 8:48
mentorNot Active11-Oct-09 8:48 
AnswerRe: dll loading? Pin
Nissim Salomon11-Oct-09 9:36
Nissim Salomon11-Oct-09 9:36 
AnswerRe: dll loading? Pin
Christian Graus11-Oct-09 10:28
protectorChristian Graus11-Oct-09 10:28 
AnswerRe: dll loading? Pin
freakyit11-Oct-09 22:22
freakyit11-Oct-09 22:22 
QuestionData Structure Pin
phobberman11-Oct-09 8:05
phobberman11-Oct-09 8:05 
AnswerRe: Data Structure Pin
riced12-Oct-09 6:21
riced12-Oct-09 6:21 
GeneralRe: Data Structure Pin
phobberman13-Oct-09 0:01
phobberman13-Oct-09 0:01 
QuestionTextbox Enter Event Pin
jonneale11-Oct-09 7:26
jonneale11-Oct-09 7:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.