backing-field

C# - How can I set the value of auto property backing fields in a struct constructor?

Given a struct like this: public struct SomeStruct { public SomeStruct(String stringProperty, Int32 intProperty) { this.StringProperty = stringProperty; this.IntProperty = intProperty; } public String StringProperty { get; set; } public Int32 IntProperty { get; set; } } Of course, a compiler error ...

How to access the backing field of a base class using fluent nhibernate?

How do i set the Access Strategy in the mapping class to point to the base _photos field? public class Content { private IList<Photo> _photos; public Content() { _photos = new List<Photo>(); } public virtual IEnumerable<Photo> Photos { get { return _photos; } } public virtual void AddPhoto() {...}...

Is there a performance difference between properties vs. backing fields in read/write operations?

When working within a class on its own fields and properties, I typically only use the property when it performs some function (like limiting a value or validating or whatever). Otherwise I prefer to read/write the backing field directly. I somehow got it in my head that this would be a more generally performant way to do things, but i...

What is the use case for Access.BackingField in Fluent NHibernate?

The documentation for Access.BackingField() indicates that this: Sets the access-strategy to use the backing-field of an auto-property. I understand that auto-properties get compiled with backing fields, but if the property is by definition a vanilla getter/setter, what advantage is garnered by going to the backing field directly v...

How do you expose a dependency property of a private, internal object via the interface of the object that contains it?

We have a custom panel class that animates its children via an internal DoubleAnimation object. However, we want to expose the animation's Duration dependency property as a public property of our panel so the user can change it in their XAML when using our panel. But we don't want to expose any other part of the animation object, just ...