Questions tagged [automatic-properties]

219 questions
1
vote
1 answer

jQuery $.ajax() var automatically $.abort()ed if reinitialized?

If a var is set to a jQuery $.ajax() call like so var ajaxVar = $.ajax(... will ajaxVar's ajax request automatically be $.abort()ed if ajaxVar is reinitialized? I have examined the docs, and I can't find an answer.
user1382306
1
vote
3 answers

Combining Properties

I'm receving an Index out bounds error on the FullName property below. I have my persondetails class and data class where I am using a SqlDataReader trying to call this property. The firstname and lastname values are returned using a stored…
Tim
  • 1,209
  • 4
  • 21
  • 33
1
vote
2 answers

Simplest way to get all MemberInfos that reflect the state of an object?

I need to get all members that represent the exact state of an object using reflection. So these members include fields (FieldInfo) and auto-properties (PropertyInfo). I can get all the FieldInfos using type.GetFields(); //ok some flags needed…
nawfal
  • 70,104
  • 56
  • 326
  • 368
1
vote
1 answer

Does SVN have an equivalent to .gitattributes?

Background: I have two Unity3d projects: The first whose Unity preferences are set to 'mixed asset' mode (some files are text, some are binary) and The second whose preferences are set to 'force text' (most binary files are translated to YAML text,…
OnlineCop
  • 4,019
  • 23
  • 35
1
vote
5 answers

How to return a new instance of an object in C# Automatic Properties

Is it possible, using C# Automatic Properties, to create a new instance of an object? in C# I love how I can do this: public string ShortProp {get; set;} is it possible to do this for objects like List that first need to be…
Russ Bradberry
  • 10,705
  • 17
  • 69
  • 85
0
votes
2 answers

How best to handle interdependent properties?

Perhaps properties aren't the way to go with this, but I'm struggling to find an answer as for a good solution. public class Blah { public double A { get{ return _B / _C; } } public double B { get{ return _A * _C; } set{…
KarlHungus
  • 237
  • 4
  • 13
0
votes
0 answers

How would I invoke setter when modifying properties in C#?

Suppose I have a class Character, which have stats of the class Stat. Specifically each character has a Character.Speed Stat that can be modified. This speed stat is heavily related to a float ActionValue, so modifying it would mean modifying action…
Lnio Yarschov
  • 23
  • 1
  • 2
0
votes
2 answers

Automatically update cells

I currently have this code for my worksheet: Private Sub Worksheet_Change(ByVal Target As Range) ' ensure events are always enabled when we exit this Sub, even if we have an error On Error GoTo errExit Application.EnableEvents = False …
0
votes
6 answers

Property getter setter in C#

I have a class library project. I have a property there like below. It's not a read only property private Int32 ABC ; public Int32 ABCD { set { this.ABC = value; } get …
Pankaj
  • 9,749
  • 32
  • 139
  • 283
0
votes
0 answers

A method to use a formula if , and if not to tip a value manual inside, without VBA Excel

Hello and thanks for the help in advance. Is there a way, for example, if cell A1 can say either yes or no, then I say in cell A2, if it says yes, then automatically write a word like "tree" in the cell, and if in cell A1 = no then the user should…
0
votes
3 answers

How do I use .NET 3.0 in VS2005?

I am trying to use Auto-implemented properties in VS2005. I have .NET 3.0 framework loaded on my machine, but Visual Studio is still compiling with .NET 2.0. How do I tell it to use .NET 3.0?
Brettski
  • 19,351
  • 15
  • 74
  • 97
0
votes
2 answers

Object reference not set to an instance of an object execep occur while add the value for list in MVC2

Object reference not set to an instance of an object Exception thrown..(Null referenceException was unhandled by user code) Model: public class AboutMod { private List divWidthList = new List(); public List DivWidthList {…
Dhana
  • 1,618
  • 4
  • 23
  • 39
0
votes
2 answers

Auto property initialization with anonymous function

I'm trying to get rid of some code with anonymous functions and classes. I stuck on this: public List Years { get; set; } = GetYears(); private static List GetYears() { List retList = new List(); …
Kamil
  • 13,363
  • 24
  • 88
  • 183
0
votes
6 answers

Can I remove { get; set; } in C#

Possible Duplicate: C#: Can I remove “{ get; set; }”? My code has hundreds of lines that look like this: public string abc { get; set; } public string def { get; set; } All have the { get; set; } at the end of them. What I am wondering is if…
Ally
  • 1
  • 1
  • 1
0
votes
2 answers

Do auto implemented properties use private constructors for their initialization

I was reading Jon Skeet's C# in depth and came across the explanation for auto-implemented properties in C# 3. The code for this was: class Product { public string Name { get; private set; } public decimal Price { get; private set; } …
thebenman
  • 1,621
  • 14
  • 35