tagged [properties]

Conditional "Browsable" Attribute

Conditional "Browsable" Attribute Is there a way to make a "Browsable" attribute conditional, so the property that applies it will sometimes appear in the properties page and sometimes not? thanks :)

properties in C#

properties in C# Why are we able to write instead of What is the difference between the two?

28 Jan at 16:38

Java and C#-like properties

Java and C#-like properties Does Java natively support properties, like C#? Or when coding in Java, when trying to encapsulate variables, you are constrained to do it by `getVariable()` and `setVariab...

8 Oct at 09:47

C# Automatic Properties - Why Do I Have To Write "get; set;"?

C# Automatic Properties - Why Do I Have To Write "get; set;"? If both get and set are compulsory in C# automatic properties, why do I have to bother specifying "get; set;" at all?

19 Dec at 10:54

How to enumerate an object's properties in Python?

How to enumerate an object's properties in Python? I C# we do it through reflection. In Javascript it is simple as: How to do it in Python?

9 Aug at 16:33

How is WPF's DependencyObject implemented?

How is WPF's DependencyObject implemented? Are there any articles that describe how the `DependencyObject` class in WPF works "under the hood"? Specifically, I'm curious about how dependency propertie...

C# protected property or field

C# protected property or field Do you think it's better to always make protected class members an auto-implemented protected property to keep isolation or make it protected field is enough? or

27 Jan at 17:58

How to check whether an object has certain method/property?

How to check whether an object has certain method/property? Using dynamic pattern perhaps? You can call any method/property using the dynamic keyword, right? How to check whether the method exist befo...

13 Aug at 14:7

Public Fields versus Automatic Properties

Public Fields versus Automatic Properties We're often told we should protect encapsulation by making getter and setter methods (properties in C#) for class fields, instead of exposing the fields to th...

Best practices: throwing exceptions from properties

Best practices: throwing exceptions from properties When is it appropriate to throw an exception from within a property getter or setter? When is it not appropriate? Why? Links to external documents o...

28 Sep at 18:1

What's the difference between the atomic and nonatomic attributes?

What's the difference between the atomic and nonatomic attributes? What do `atomic` and `nonatomic` mean in property declarations? What is the operational difference between these three?

How to prevent auto implemented properties from being serialized?

How to prevent auto implemented properties from being serialized? How can I prevent a auto implemented property from being serialized by the binary formatter? The [NonSerialized] attribute can only be...

Accessing an object property with a dynamically-computed name

Accessing an object property with a dynamically-computed name I'm trying to access a property of an object using a dynamic name. Is this possible?

16 Nov at 18:53

C# Reflection: Fastest Way to Update a Property Value?

C# Reflection: Fastest Way to Update a Property Value? Is this the fastest way to update a property using reflection? Assume the property is always an int:

28 May at 00:5

C# Properties, Why check for equality before assignment

C# Properties, Why check for equality before assignment Why do I see people implement properties like this? What is the point of checking if the value is equal to the current value?

16 Aug at 07:1

C# Get property value without creating instance?

C# Get property value without creating instance? Is it possible to get value without creating an instance ? I have this class: Now I need get the value "David", without creating instance of MyClass.

21 Jul at 04:33

C#3.0 Automatic properties, why not access the field directly?

C#3.0 Automatic properties, why not access the field directly? With the new approach of having the get/set within the attribut of the class like that : Why simply not simply put the attribute FirstNam...

29 Oct at 17:19

.NET DefaultValue attribute

.NET DefaultValue attribute I've heard people say a few different things about the `DefaultValue` attribute including: - - - Which (if any) is right? Does `DefaultValue` actually set default values? A...

24 May at 14:41

Interface inheritance: is extending properties possible?

Interface inheritance: is extending properties possible? I want to do this: So that `IInherited` would have the property `Property1` with added functionality to allow `set`. Is that possible? What's t...

18 Aug at 21:19

Listen to changes of dependency property

Listen to changes of dependency property Is there any way to listen to changes of a `DependencyProperty`? I want to be notified and perform some actions when the value changes but I cannot use binding...

Is a public getter and a private setter with same name possible in C#?

Is a public getter and a private setter with same name possible in C#? How can I create a public getter and a private setter for a property? Is the following correct?

24 May at 09:47

Instance member cannot be used on type

Instance member cannot be used on type I have the following class: Compilation fails with the message: > Instance member 'categoriesPerPage' cannot be used on type 'ReportView' What does this mean?

Raise an event whenever a property's value changed?

Raise an event whenever a property's value changed? There is a property, it's named I'm going fire an event whenever its value changed. I am aware of changing `INotifyPropertyChanged`, but I want to d...

18 Feb at 17:23

How do I enumerate the properties of a JavaScript object?

How do I enumerate the properties of a JavaScript object? How do I enumerate the properties of a JavaScript object? I actually want to list all the defined variables and their values, but I've learned...

1 Jun at 22:50

Boolean Property Getter and Setter Locking

Boolean Property Getter and Setter Locking Is there any reason why you would create locks around the getter and setter of a boolean property like this? ``` private _lockObject = new object(); private...

29 Jul at 13:33