property

why GetChanges returns something (when bound to a property) even if there are no changes on datatable?

Bound GetChanges always returns something when bound to a usercontrol's property (even on a simple one) i have made a usercontrol, for some reason unknownst to me, when i bound a datacolumn to my control's property the dataSet1.GetChanges() always return something, even the column bound to my control was not changed. what's the possibl...

How to implement property() with dynamic name (in python)

Hello together and a happy new year 2009! I am programming a simulations for single neurons. Therefore I have to handle a lot of Parameters. Now the Idea is that I have two classes, one for a SingleParameter and a Collection of parameters. I use property() to access the parameter value easy and to make the code more readable. This works...

WPF: how to display enum property values in vs2008 xaml editor intellisense?

i created a wpf custom control with a dependency property of an enum type. i want the user of that control when editing the xaml in vs to see the optional values of the enum in the intellisense window. does anyone know how it can be done? ...

How to diff Property Values of two objects using GetType GetValue?

I have the following classes: public class Person { public String FirstName { set; get; } public String LastName { set; get; } public Role Role { set; get; } } public class Role { public String Description { set; get; } public Double Salary { set; get; } public Boolean HasBonus { set; get; } } I want to be abl...

C# Assigning default property for class and operator =

Problem 1: I have a simple winforms app and I want to DataBind my Person.Name property to a textbox. Name is of type StringField. I originally defined the Name property as String. The data binding works great on value types such as String. I would like the StringField.Value property to be the default property of StringField. I want to s...

Modifying setter argument - is it hack or not?

Is it normal to modify setter arguments? Let's imagine that we have setString method. And we really want to keep a trimmed form of the string. So a string with trailing spaces is invalid, but we don't want to throw an exception. What's the best solution? To trim the value in the setter e.g. public void setString(String string) { th...

Resticting access to method calls on read-only properties

I have a class that defines a read-only property that effectively exposes a private field, something like this: public class Container { private List<int> _myList; public List<int> MyList { get { return _myList;} } public Container() : base () { _myList = new List<int>(); } // some method tha...

Entity Framework: Creating custom properties

Consider an implementation of the Entity Framework in a DAL assembly. I am needing to add a custom read-only property to an entity. Person Class, as defined in the DB, contains fields like: PersonID FirstName LastName In the above example, I'd like to make a property called FullName. It would be the concatenation of FirstName + " "...

How would one access object properties in CIL (MSIL)?

I'm an absolute beginner, you see. Say I have a string object on the stack and want to get the number of characters in it - its .Length property. How would I get the int32 number hidden inside? Many thanks in advance! ...

How to represent a C# property in UML?

Not quite an Attribute, not quite a Method. Stereotypes? <<get>> <<set>>? I'm retro-modelling an existing system, so I need to clearly reflect that this is not the same as a readonly field or a methods pair (regardless of what the IL says), so I think I'll go with the stereotype, but I'll accept the language independant get set_ as a ...

Can a php class property be equal to another class property?

I want to do this: class MyClass { var $array1 = array(3,4); var $array2 = self::$array1; } and $array2 doesn't work. Do you have a solution/trick to make a class property equal to another class property? Thanks. ...

Why won't anyone accept public fields in C#?

Seems like every C# static analyzer wants to complain when it sees a public field. But why? Surely there are cases where a public (or internal) field is enough, and there is no point in having a property with its get_ and set_ methods? What if I know for sure that I won't be redefining the field or adding to it (side effects are bad, rig...

calling methods on an instance with getattr [ python ]

I was trying to write some code that would check if an item has some attributes , and to call them . I tried to do that with getattr , but the modifications wouldn't be permanent . I made a "dummy" class to check upon this . Here is the code I used for the class : class X: def __init__(self):...

Dynamic Properties for object instances?

Hi After the previous question "What are the important rules in Object Model Design", now I want to ask this: Is there any way to have dynamic properties for class instances? Suppose that we have this schematic object model: http://www.freeimagehosting.net/>http://www.freeimagehosting.net/uploads/d3a08e6c83.gif border=0 alt="Free Im...

C# thread safety with get/set

Hi all, This is a detail question for C#. Suppose I've got a class with an object, and that object is protected by a lock: Object mLock = new Object(); MyObject property; public MyObject MyProperty { get { return property; } set { property = value; } } I want a polling thread to be able to query ...

Bind to animated property (WPF)

Hi, Does anybody knows, if there is a way to use a property that is animated as source for a binding? As far as I found out, is that an animation doesn't "really" set the value on the property, and therefore doesn't fire the changed events, which is needed to trigger the binding. tia Martin ...

Python "property object has no attribute" Exception

Hi guys, confirmation = property(_get_confirmation, _set_confirmation) confirmation.short_description = "Confirmation" When I try the above I get an Exception I don't quite understand: AttributeError: 'property' object has no attribute 'short_description' This was an answer to another question on here but I couldn't comment on it a...

Rhino Mocks - Verify Property Set when Property has no Get

If you have a property: public class Fred { public string UserName { set { userName=value; } } } how do you use Rhino Mocks to check that fred= new Fred(); fred.UserName="Jim"; is called. Expect.Call(mockFred.UserName).SetPropertyWithArgument("Jim"); does not compile. ...

UML sequence diagram call property

In my app i have a Document class and a DocumentFact class. The DocumentFact class contains methods which will get multiple Documents from the database. These documents are stored in a datatable or dataset. Both (datatable, dataset) are private members of the documentfact class. They can be accessed via properties. Now my question is: i...

How do I enable the 'auto fill' option for a property in VS 2005?

How do I enable the 'auto fill' option for a property in VS 2005? ...