Click here to Skip to main content
15,897,226 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have been reading C# for some time now
but i am having problem with using my class as
a user define type.

eg. string name;//names can accept values from TextBox

and i have a class

Public class Bottle
{
public Bottle()
{

}

}

how do i use my class a type???

Can someone help me out???
Posted

1 solution

It seems to me that you need to reed a book about the basics of C# (or OO programming in general...).

Anyway, here is your answer:
// Create a new variable of your custom type

Bottle myBottle;


// Create a new Bottle object and assign it to our variable

myBottle = new Bottle();
 
Share this answer
 
v3

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900