0
голосов
2ответов
40 просмотров

Is SearchString acting like a property?

Is SearchString acting as property of Page class? Here is code, <%@ Page Language="C#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> public string SearchString { ...

74
голосов
7ответов
31920 просмотров

When and how to use the builtin function property() in python

It appears to me that except for a little syntactic sugar, property() does nothing good. Sure, it's nice to be able to write a.b=2 instead of a.setB(2), but hiding the fact that a.b=2 isn't a simple assignment looks like a recipe for trouble, either because some unexpected result can happen, suc...

10
голосов
3ответов
9371 просмотров

WPF: Cannot set properties on property elements weirdness

private TextBlock _caption = new TextBlock(); public TextBlock Caption { get { return _caption; } set { _caption = value; } } <l:CustomPanel> <l:CustomPanel.Caption Text="Caption text" FontSize="18" Foreground="White" /> </l:CustomPanel> Gives me the ...

56
голосов
5ответов
21101 просмотров

Properties and Instance Variables in Objective-C

I'm rather confused about properties and instance variables in Objective-C. I'm about half-way through Aaron Hillegass's "Cocoa Programming for Mac OS X" and everything is logical. You would declare a class something like this: @class Something; @interface MyClass : NSObject { NSString *na...

3
голосов
2ответов
264 просмотров

Unnecessary temporary variables when setting property values?

I'm following a book on iPhone development and there is a particular pattern I keep seeing in the example code that doesn't make much sense to me. Whenever a property is set they first assign a pointer to the new value for the property, then set the property to the pointer, then release the point...

1
голосов
1ответов
1014 просмотров

Change Property Attribute Like ReadOnly at Design-Time (PropertyGrid)

I develop a custom control that have some field like below: ControlKind, Field1 , Field2 I want to change attribute of one of field per controlKind, Like: if controlKind == useField1, then Field1 show and Field2 hidde in properyGrid (or readonly or filter) can i do it ? Thanks in advance

2
голосов
3ответов
13163 просмотров

ASP.NET: How do I access a property of my UserControl, from within JScript?

I need read-access to a user-defined property of my UserControl, from within a <script> element. This script needs to run when the user clicks on the link (which I also don't know how to setup). Thanks for your advice, SO! Code-behind: public partial class TNLink : System.Web.UI.UserCon...

10
голосов
5ответов
6251 просмотров

How do I make my Java application identify itself to Oracle on connection?

When my application connects to an Oracle database I want to be able to see by looking at the active sessions in the database that it is connected. Currently it identifies itself as "JDBC Thin Client" because that's the driver that I'm using, but other Java based applications that I have are some...

30
голосов
11ответов
13328 просмотров

Fields vs Properties for private class variables

For private class variables, which one is preferred? If you have a property like int limit, you want it to be: int Limit {get; set;} and use it inside the class, like so: this.Limit Is there a reason to use it or not use it? Maybe for performance reasons? I wonder if this is a good practi...

1
голосов
1ответов
6665 просмотров

Entities: Adding a Navigation Property between a View and Table

As you can seen in the diagram below there is a one-to-many relationship between the ProjectTask and Dependency table. Entities tries to map every field in the View to fields in the Dependency table, which wouldn't work. Any suggestions on how I can add the navigation property? Thanks, Abe ...

0
голосов
2ответов
2290 просмотров

How to set bindings for generic properties of custom activity in workflow foundation

I have a custom class called "Parameter" and a custom activity with generic collection property called "Parameters", and I want to set bindings for one of Parameters in the generic list of Parameters Property,I've tried with activitybind, but it is not working, is there any way to do it with work...

2
голосов
4ответов
1115 просмотров

Why does a GetType on a string-property result in a NullReferenceException?

When I call a GetType on a int- or a DateTime-property, I get the expected results, but on a string-property, I get a NullReferenceException (?) : private int PropInt { get; set; } private DateTime PropDate { get; set; } private string propString { get; set; } WriteLine(PropInt....

16
голосов
2ответов
14305 просмотров

UIButton.layer.cornerRadius doesn't exist?

I'm implementing a custom UIButton with minimal functionality. The .h file: #import <Foundation/Foundation.h> @interface CustomButton : UIButton { } @end I'm encountering a compilation error at line (A) in the .m file: - (id)initWithCoder:(NSCoder *)coder { if(self = [super initWith...

59
голосов
5ответов
44515 просмотров

How to get the numeric value from the Enum?

For example System.Net.HttpStatusCode Enum, I would like to get the HTTP Status Codes instead of the HTTP Status Text. System.Net.HttpStatusCode.Forbidden should return 403 instead of "Forbidden". How can I extract the value?

2
голосов
2ответов
2419 просмотров

Filling out Object Properties with default values Recursive

I want to populate the object's properties with some dummy data. Here is my code but it always returns null. private static object InsertDummyValues(object obj) { if (obj != null) { var properties = obj.GetType().GetProperties(BindingFlags.Instance | BindingFlags.DeclaredOnly | ...

1
голосов
3ответов
688 просмотров

Objective-C 101: dot notation and object properties

I have a very basic question regarding properties in Objective-C. I can only access object's properties via dot notation (Obj.MyProp) if I @synthesize myProp. Is that correct? Would it be true to say that if I use my own setter method, I will no longer be able to refer to property in dot notati...

1
голосов
2ответов
551 просмотров

How To: Dynamically-defined properties in .NET

I've created a couple of Comparer classes for FileInfo objects to allow sorting by Name and LastWriteTime properties, but ideally I'd like to combine them into once class, so that I can compare/sort by any property simply by passing through the chosen property name. However, I don't know how to ...

4
голосов
4ответов
10927 просмотров

Convert type in setter method, possible? When yes how?

guess I wanted to gernerate a commandline with flags and so on. Flags are of type bool but the commandline is a string like " /activeFlag". Is there a way to program a setter in C# which takes a bool but the getter returns a string? like private string activeFlag { get { return activeFlag; } ...

7
голосов
2ответов
5127 просмотров

Subversion: how to remove property on commit

My situation is this: I have a Subversion server set up at my home, and we also use Subversion at the company where I work. At work, we use the lock/edit/unlock model (mainly because we are transitioning from Visual SourceSafe and it's easier for the moment). At the moment this is achieved by s...

0
голосов
1ответов
121 просмотров

Setting Properties In Once Class, Accessing From Another

My question is basically this: If I set dynamic data from one class, can I access that same data from another class? Below is the rough pseudocode of what I am trying to do: Public Class Person { public string ID { get; set; } public string Name { get; set; } } And, I do the below: Pu...

4
голосов
7ответов
1921 просмотров

How to restrict to add an item to List<t>?</t>

I have Class called Person containing to properties, Father and List of Children. I want every one to use only AddChild Method to add children, not the List.Add method , so how do I restrict use of it? public class Person { private List&lt;Person&gt; _children = new List&lt;Person&gt;(); pu...

4
голосов
1ответов
421 просмотров

Possible to get used maven version to insert into a filtered resource file?

I wonder, if it is possible to get currently used version of maven for filtering resource file. I've a resource file, that is filtered by maven: version=${project.version} buildDate=${timestampFormatted} buildBy=${user.name} name=${project.artifactId} buildVersion=${build.number} osName=${os.na...

0
голосов
1ответов
1482 просмотров

Spring: can ResourceBundleMessageSource be configured to load properties in xml format

As you may know, properties are usually written in files in key=value format but can also be written in XML format. The question is if (and how) can Spring's ResourceBundleMessageSource be configured to load properties in XML format.

4
голосов
2ответов
17044 просмотров

maven ${user.home} not being resolved correctly

I've got the following line in my pom.xml: &lt;updateRepositoryURL&gt;file:/${user.home}/.m2/repository/repository.xml&lt;/updateRepositoryURL&gt; and when I am attempting to use it within my program the resultant string is: file:/c:Documents and Settings&lt;myusername&gt;/.m2/repository/repo...

8
голосов
4ответов
4275 просмотров

Constant instance variables?

I use @property to ensure that changes to an objects instance variables are wrapped by methods where I need to. What about when an instance has an variable that logically should not be changed? Eg, if I'm making a class for a Process, each Process instance should have a PID attribute that will ...

3
голосов
2ответов
1198 просмотров

Saving Word 2007 Document Properties in C# 2.0

I'm trying to modify some CustomDocumentProperties for a .docx document. I've been able to read the current value and modify it, but when I save the document the changes to the custom fields are lost. I have the following method within a DocAccessor class (which serves as an interface for my do...

0
голосов
3ответов
2785 просмотров

Cannot use parentheses when calling a Sub

I have a Classic ASP page that contains the following code to attempt a parametised query; &lt;% Set cmdEmail = Server.CreateObject("ADODB.Command") Set rsEmail = Server.CreateObject("ADODB.Recordset") cmdEmail.CommandText = "SELECT * FROM VWTenantPropertiesResults WHERE ContentID = ?" cmdEmail...

1
голосов
4ответов
4809 просмотров

Cloning a TStringGrid Component

I am starting to learn Delphi. So I decided to write an application like MS Excel from scratch. In a new Form1, I did put a TPageControl component containing only 1 page. In that page, I did put a TAdvStringGrid and a TPanel with some buttons (button1, button2) and a Popup1 menu for defining some...

3
голосов
2ответов
972 просмотров

LINQ Is it possible to get a method name without a return type via LINQ expression trees?

I know it is possible to retrieve a property name or a method with a return type. But is it also possible to get a method name without a return type via LINQ expression trees? Example: string methodname = GetMethodname(x=&gt;x.GetUser()); ---&gt; results: "GetUser"

16
голосов
8ответов
22128 просмотров

Why we need Properties in C#

Can you tell me what is the exact usage of properties in C# i mean practical explanation in our project we are using properties like /// &lt;summary&gt; /// column order /// &lt;/summary&gt; protected int m_order; /// &lt;summary&gt; /// Get/Set column order /// &lt;/summary&gt; public int Ord...