User defined type
examples for user defined type in c#???
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Ravi KumarRank #2,085 · 690 reputationPosted Aug 19, 2014, 4:19 AM EDT
You can create an User Defined Datatype Students like this:
public class Students
{
private string _rollno;
private string _name;
public string rollno
{
get
{
return _rollno;
}
set
{
_rollno = value;
}
}
public string name
{
get
{
return _name;
}
set
{
_name = value;
}
}
}
You can use the class, like this:
Students s = new Students();
s.rollno = "S001";
s.name = "Ram";
VulpesRank #55 · 29.2K reputationPosted Aug 19, 2014, 5:03 AM EDT
Even apparently built-in types in C# such as object, int, bool are just aliases for the .NET framework types: System.Object, System.Int32 and System.Boolean respectively.
Najna Abdulla101 reputationPosted Aug 19, 2014, 4:30 AM EDT
Najna Abdulla101 reputationPosted Aug 19, 2014, 4:30 AM EDT
Najna Abdulla101 reputationPosted Aug 19, 2014, 4:30 AM EDT
Ankur JainRank #2,475 · 567 reputationPosted Aug 19, 2014, 4:46 AM EDT
Here is the example with structure...
Ravi KumarRank #2,085 · 690 reputationPosted Aug 19, 2014, 8:08 PM EDT