Login
Register
Tutorials
Forum
Career Development
Resources
Reviews
Jobs
Interview
Communities
Projects
Training
Silverlight Games
|
Bookmarks
|
New Members FAQ
|
Mentor
|
Code Converter
|
IT Companies
|
Peer Appraisal
|
Members
|
Revenue Sharing
|
Computer Jokes
|
New Posts
|
Social
|
Talk to Webmaster
Tony John
Facebook
Google+
Twitter
LinkedIn
Online Members
sharmila
malika
Sidharthan
monika
naveensanagasetti
Pawan Awasthi
More...
Join our online
Google+ community
for Bloggers, Content Writers and Webmasters
Forums
»
.NET
»
.NET
»
I have one doubt on oops concept
Posted Date:
11 Jul 2012
Posted By::
Rama Murthy
Member Level:
Silver
Member Rank:
1261
Points
: 2
Responses:
4
what is a property?
we can write without set and get method?
we can write only set method without get method?
we can write only get method without set method?
send the answer
Tweet
Responses
#679861 Author:
Narendra Reddy vajrala
Member Level:
Gold
Member Rank:
164
Date: 11/Jul/2012 Rating:
Points
: 2
1). If you write a Property without Get and Set, that will become a field. It stores only actual data means what ever you assign that only it holds and you cant access out side of that class.
2)& 3).
YES, you can write any one of them without other depends on your requirement.
--Naren
----------
Jai Sri Ram
#679865 Author:
jogesh
Member Level:
Gold
Member Rank:
229
Date: 11/Jul/2012 Rating:
Points
: 4
Property is a way to expose private field. With property a developer is allowed to either set (write) data or get (read) data. If you do not have a setter it becomes a readonly property. You can not write a property without a set or get atleast one in required. You can shortcut like write prop and press tab to generate a skeleton of property. You can also attach attributes to it, to make it more customizable. Example of a proeprty: open the proeprty explorer in the visual studios, it will list all the proeprties exposed by visual studio. Like color, font etc.
#679868 Author:
chandramohan
Member Level:
Gold
Member Rank:
221
Date: 11/Jul/2012 Rating:
Points
: 2
class Person
{
private string name; // the name field
public string Name // the Name property
{
get
{
return name;
}
}
}
#679910 Author:
Anil Kumar Pandey
Member Level:
Platinum
Member Rank:
1
Date: 11/Jul/2012 Rating:
Points
: 2
1. Yes You can have a Member variable with out Set and Get
2. Yes, A property can have only set where it can not be Read
2. Yes, A property can have only get where it can be Read only we can not assign values
Thanks & Regards
Anil Kumar Pandey
Microsoft MVP, DNS MVM
Post Reply
This thread is locked for new responses. Please post your comments and questions as a
separate thread
.
If required, refer to the URL of this page in your
new post
.
Tweet
Next :
To print the numbers using C# .net
Previous :
Changing cursor position dynamically in a word.table
Return to Discussion Forum
Post New Message
Category:
Related Messages
Is there any expert to solve this?
what is difference between String and string(data type) in c#?
what is a resource file...
Horizontal Scroll Bar for a listview control
sql querry
Follow us on Twitter:
https://twitter.com/dotnetspider
Active Members
Today
baskar
(41)
srirama
(33)
naveensanagase...
(30)
Last 7 Days
baskar
(350)
Ultimaterengan
(259)
srirama
(200)
more...
Awards & Gifts
Email subscription
.NET Jobs
.NET Articles
.NET Forums
Articles Rss Feeds
Forum Rss Feeds
About Us
Contact Us
Copyright
Privacy Policy
Terms Of Use
Revenue Sharing sites
Advertise
Talk to
Tony John
Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
2005 - 2012 All Rights Reserved.
.NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
Articles, tutorials and all other content offered here is for educational purpose only.
We are not associated with Microsoft or its partners.