471,336 Members | 1,390 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,336 software developers and data experts.

Object Properties not set any issues

Hi,

I have created an C# Class with 12 properties. I am using only two
properties. Are there any performance issues in doing that. or I have
to create a Class with only two properties. I created 12 properties
because I might use them in future.

Example:

class car
{
int vehicleNo;
int make;
int model;
Sep 2 '08 #1
3 944
"vital" <vi***********@gmail.comwrote in message
news:48**********************************@25g2000h sx.googlegroups.com...
I have created an C# Class with 12 properties. I am using only two
properties. Are there any performance issues in doing that.
Not likely. Of course, the backing fields for the properties will still be
there, whether you've changed their values or not. But unless you're going
to have thousands of those objects around, it is hardly going to matter.
Sep 2 '08 #2
On Sep 2, 4:38 am, "Pavel Minaev" <int...@gmail.comwrote:
"vital" <vital.madd...@gmail.comwrote in message

news:48**********************************@25g2000h sx.googlegroups.com...
I have created an C# Class with 12 properties. I am using only two
properties. Are there any performance issues in doing that.

Not likely. Of course, the backing fields for the properties will still be
there, whether you've changed their values or not. But unless you're going
to have thousands of those objects around, it is hardly going to matter.

Why I asked it because some of the properties are of type
"HttpPostedFile". Which
I am not using now but I might use later. From ur reply I understood
it doesn't matter.
in performance. Can I use structs instead of class here
Sep 2 '08 #3
On Sep 2, 4:55*pm, vital <vital.madd...@gmail.comwrote:

<snip>
Why I asked it because some of the properties are of type
"HttpPostedFile". Which
I am not using now but I might use later. From ur reply I understood
it doesn't matter.
If you don't set any values, the backing variables will just have
values of null.
in performance. Can I use structs instead of class here
Why would you particularly want to? It's very unusual to create your
own structs in C#. Are these naturally "fundamental" value types?

Jon
Sep 2 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Roger Maynard | last post: by
1 post views Thread by Chris Dunaway | last post: by
12 posts views Thread by Andrew Poulos | last post: by
3 posts views Thread by Techno_Dex | last post: by
7 posts views Thread by Steve | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.