Questions tagged [automatic-properties]
219 questions
0
votes
2 answers
virtual auto implemented properties backed field
Does auto implemented properties have the same backed field in base and derived classes in C# ?
I have the following code:
class Employee
{
public virtual string Infos { get; set; }
}
class Engineer : Employee
{
…

Brahim Boulkriat
- 984
- 2
- 9
- 21
0
votes
2 answers
Automatic properties fail to initialize in C# instance constructor
I need a sanity check to determine whether my C# compiler is broken or I'm not understanding how automatic properties are supposed to work.
Given the following class definition and constructor, note the respective member values.
public class…

John Holliday
- 1,268
- 1
- 11
- 19
0
votes
2 answers
c# properties, have a get with an auto-implemmented private set
Using c# auto-implemented properties can I have a class that does the following (psuedo C# code because I get an error - which is below when trying to compile this):
public class Foo {
public String HouseName { get; private set; }
public int…

Josh R
- 1,970
- 3
- 27
- 45
0
votes
2 answers
Skipping fields on model classes
Recently, after reading a lot of tutorials around the Internet, I've noticed that some developers skips writing the fields in their model classes and just go with properties, like this:
public class MyClass
{
public string MyProperty { get;…

bomortensen
- 3,346
- 10
- 53
- 74
0
votes
1 answer
How to easily change Automatic Property to Full Property?
I have a lot of properties that were originally implemented using automatic properties. Is there an easy way to change automatic properties to fully implemented properties without having to basically delete the properties and start over? In VB, I…

Josh McKearin
- 742
- 4
- 19
- 42
0
votes
1 answer
Automatic Goal Seek Over Range of Cells
I want to apply goal seek across several rows when there is a change to any cell in the work sheet. I want to apply this from row 7 to row 11. The first problem I have is that excel is crashing each time I run this. I am just starting to learn…

user2324441
- 11
- 1
- 1
- 3
0
votes
0 answers
Do SVG files automatically compress to their smallest possible pixel size based on their attributes?
I'm working on a bit of code that generates graphs in SVG, and I want to know what the size of the generated SVG file will be. For, instance, for the following set of two lines:

Aleksey Bilogur
- 3,686
- 3
- 30
- 57
0
votes
1 answer
Passing auto properties as ref
The C# compiler doesn't allow this. What's the reason for this? And what workaround I can use?
Basically I need to swap some values around, but don't wanna have the same swapping code all over.

Joan Venge
- 315,713
- 212
- 479
- 689
0
votes
2 answers
How can I get field's value if it's defined as automatic property?
How can I get field's value if it's defined as automatic property?
I don't know why but first time I encounter such simple task with such an unexplained method called GetValue which don't work as I want to and usually throws all kinds of exceptions…

JavaSa
- 5,813
- 16
- 71
- 121
0
votes
1 answer
Assigning a value to baseclass property and accessing it from child class causing the debugger to Force stop
i have a Base class for properties
public class Parameters
{
public string caption
{
get;
set;
}
public string subcaption
{
get;
set;
}
public string bgColor
{
get
…

G--
- 497
- 1
- 8
- 25
0
votes
1 answer
Multiline values in Subversions autoproperties possible?
Is it possible to create a property in the autoprops section of .subversion/config file which contains multiline values?
So that it would look like:
svn pg myprop
will output
1st line of prop
2nd line of prop

Peter Parker
- 29,093
- 5
- 52
- 80
0
votes
2 answers
properties without body
Possible Duplicate:
What’s the difference between encapsulating a private member as a property and defining a property without a private member?
In C#, usually when I define a property I declare and implement a single line or more for get and…

amit kohan
- 1,612
- 2
- 25
- 47
0
votes
1 answer
OpenOffice.org/LibreOffice Calc macro: is a cell's content currently overflowing?
I have a bunch of cells whose font size I'd like to tweak if their content is overflowing, until it all fits. I'd like to write a macro to do this, unless there's a conditional formatting or other formulaic way of doing it. Is there a property…

Kev
- 15,899
- 15
- 79
- 112
0
votes
1 answer
c# Autoproperties and Dictionary
I have a base case that gets derived so i have few int and string Auto properties
// base class
public virtual int MyVariable {get; set; };
// Derived class
private int myVariable = 0;
public override int MyVariable
{
…

Nida Sahar
- 698
- 4
- 13
- 29
0
votes
1 answer
c# wcf inherited [DataContract]
if I define a my types like this:
public class UniqueNamedItem
{
int Id {public get; protected set;}
int Name {public get; protected set;}
}
[DataContract]
public class Product : UniqueNamedItem
{
[DataMember]
//lots of properties…

Daniel Robinson
- 13,806
- 18
- 64
- 112