property

How do you add a property to a function object on the PSDrive "function:"?

I've attempted using the $function:foo value and get-item function:foo. All attempts succeed in modifying the temporary function object, but the additional property is missing when reassigned to the stored function (either through $function:foo = ... or set-item function:foo ...). Here are the results of my attempts (all fail): Setup ...

The value for the useBean class attribute ... is invalid

I want to use a java file "SaveProp" which is written in a package "user". The class file has been placed in the WEBINF/classes.Below are the two lines which causes the issue. jsp:useBean id="user" class="user.SaveProp" scope="session" jsp:setProperty name="user" property="*" This is the code, but it throws, The value for the useBean...

What does "Is Identity" column property mean in SQL Server?

I am using SQL Server for the first time and I see that a column property is called Is Identity. What doeds this mean? What are the advantages of marking a column property as Is Identity = Yes ? Thanks in advance. ...

ASP.NET server control property issue(?)

I am working on some ASP.NET Server Control, and I have an issue. Maybe I oversee something, I don't know. Anyway: public string Name { get { String s = (String)ViewState["name"]; return ((s == null) ? String.Empty : s); } set { ViewState["name"] = value; } } protected override void R...

How do I use Linq to obtain a unique list of properties from a list of objects?

I'm trying to use Linq to return a list of ids given a list of objects where the id is a property. I'd like to be able to do this without looping through each object and pulling out the unique ids that I find. I have a list of objects of type MyClass and one of the properties of this class is an ID. public class MyClass { public int ...

How to determine if Native JavaScript Object has a Property/Method?

I thought this would be as easy as: if(typeof(Array.push) == 'undefined'){ //not defined, prototype a version of the push method // Firefox never gets here, but IE/Safari/Chrome/etc. do, even though // the Array object has a push method! } And it does work fine in Firefox, but not in IE, Chrome, Safari, Opera, they return all pr...

Looking for DependencyProperty.Register shortcut.

Defining WPF properties is too long: public static readonly DependencyProperty FooProperty = DependencyProperty.Register("Foo", typeof(string), typeof(FooClass), new PropertyMetadata("Foooooo")); I have a helper method, making it a bit shorter: public static readonly DependencyProperty FooProperty = WpfUtils.Property<string, Foo...

How to get the value of a msbuild property from a custom task?

Is there some way to access the value of a msbuild property from a custom task? I know I can send them all in, but it would be nice not to :) Trying to do this from a tfs build. Or is there som way to access the "build script" currently running? Maybe like an object model and from there get what I need? ...

c# DataBinding to string property on a Generic

Guys, I'm trying to Databind to my custom dictionary class. In formLoad, I can bind to Car.Desc but I cannot bind to RatesCache.Desc. They are both public string properties. What am I missing? Thanks! System.ArgumentException was unhandled Message="Cannot bind to the property or column Desc on the DataSource.\r\nParameter name: ...

"Read only" Property Accessor in C#

I have the following class: class SampleClass { private ArrayList mMyList; SampleClass() { // Initialize mMyList } public ArrayList MyList { get { return mMyList;} } } I want users to be able to get mMyList which is why i exposed the "get" via a property however i don't want changes they make to th...

How to design a static class?

I want to create a special class for holding a lot of values like strName, strNo, intPassword...So that several other classes can modify the same value in this class. I want to use the dot syntax to call its properties like Values.strName = ...; I don't want to initialize the class everytime before I read/write its values because some o...

ObsoleteAttribute confusion

I would like to apply ObsoleteAttribute to a property, but it seems that compiler generates warnings/errors only for direct usage of attribute, any indirect usage is silently ignored. I think the following example illustrates the problem very well: using System; class Program { static void Main(string[] args) { var o = new Old(); ...

Delphi: properties with same name in descending class

In one file, I have a baseclass with a ID-property: type TBase = class(TObject) private FID: integer; public property ID: integer read FID write SetID; end; In a second file, I have another class, descending from TBase. By accident, or ignorance or what ever, a new property/field with the same name as an exsi...

MarkupExtension as computed property in Template

Having such MarkupExtension public class Extension1 : MarkupExtension { private static int _counter = 0; public override object ProvideValue(IServiceProvider serviceProvider) { return string.Format("Item {0}", _counter++); } } and this XAML <ListBox> <ListBoxItem Content="{my:Extension1}"></ListBoxItem> <...

how to get name of a class property?

Is there anyway I can get the name of class property "IntProperty"? public class ClassName { public static int IntProperty { get { return 0; } } } //something like below but I want to get the string of "IntProperty" ClassName.IntProperty.GetType().Name Basically what I want to do is to dyanmically save property name string into dat...

Outside Property inside a DataTemplate WPF

Scenario: I have a ListBox and the ListBoxItems have a DataTemplate. What I want to do is put a ContextMenu in the DataTemplate. The catch is that I want this ContextMenu ItemsSource to be different depending on certain properties in the window. My initial thought is that I could just bind the ItemsSource to a Property in the window and ...

Is it possible to have class.property = x return something other than x?

Let's say I have a Ruby class: class MyClass def self.property return "someVal" end def self.property=(newVal) # do something to set "property" success = true return success # success is a boolean end end If I try and do MyClass.property=x, the return value of the whole statement is always x. It is a convention i...

ActionScript 3 name property is not returning the right name...?

Hi all, I experienced a problem with the name property in as3, I created this "dot" movieclip and I exported to a class, then I anonymously created a bunch of dots using a loop. I assigned numbers as name to each dots private function callDots(num:Number):void { for (var i = 0; i < subImagesTotal[num]; i++) ...

Inserting an element into xml produces an unnecessary propertry xmlns=

Whenever I insert an element into my xml document, the system adds an xmlns="" attribute to it. How do i get rid of it? Why is it there? Im using very simple linqtoxml. I've got a simple XML file (Note there is no Xml declaration line and it contains a namespace): <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/deve...

Best practice when assigning a collection reference to a property

I'm heavily geared towards C++ thinking and need some guidance on a specific C# matter. Let's assume we have the following class: public class Foo { private IList<Bar> _bars = new List<Bar>(); // Note IList<> vs List<>. public IList<Bar> Bars { get { return _bars; } set { ... } ...