Questions tagged [automatic-properties]
219 questions
0
votes
1 answer
Multiple Dynamic Object Properties
i'm wondering if its possible to create multiple Properties of an Object inside a for loop.
im trying it like this, but it isn't working correct:
var dataObjekt= {};
for(var i=0;i

David
- 1,084
- 12
- 36
0
votes
2 answers
deleting unnecessary characters from txt document
I am facing a bit of a problem, i am not good at programming yet.
i have a text that looks like this:
D28151373 15-04 040 028230457 01-01 015 D28250305 01-08 048 D28250661 03-01 032 028151376 12-01 057 028230460 01-01 001 D28250305 01-09 049…
0
votes
2 answers
NHibernate ID Private Setter (any workaround)
Here is a "simplified" class that can be mapped using NHibernate;
public class Template
{
public virtual int Id { get; private set; }
public virtual string Name { get; set; }
}
As the ID field has a private setter we can no longer have code…

Piere
- 83
- 1
- 4
0
votes
1 answer
Use multiple ClientAuthentiation with spring-vault
We have an application using spring-vault. It authenticates to Vault using an AppRole. We use the token we get from that operation to read and write secrets. The configuration for the VaultEndpoint and AppRoleAuthentication are auto-configured from…

ixe013
- 9,559
- 3
- 46
- 77
0
votes
3 answers
Update a class property based on another property's value in the setter
I have two model classes:
public class Person
{
public int PersonId { get; set; }
public string Name { get; set; }
public int AddressId { get; set; }
public Address AddressInfo { get; set; }
}
public class Address
{
public int…
user7784919
0
votes
3 answers
Control the XML generated for automatic properties
Can anyone explain how to control the XML generated ?
I have a simple test class, NumberService ...
[Serializable]
public class NumberService
{
public int Number1 { get; set; }
public int Number2 { get; set; }
}
Now if I use an…

SteveC
- 15,808
- 23
- 102
- 173
0
votes
0 answers
Alter Auto-Property Behavior using Custom Attribute
I have a class with two different properties that map to the same value:
class MyClass {
public int Number { get; set; }
public string NumberString {
get { return Number.ToString(); }
set { Number = int.Parse( value ); }
…

Mikkel R. Lund
- 2,336
- 1
- 31
- 44
0
votes
1 answer
C#: Internal and public interfaces, auto-implemented properties, but with structs…
I know there's a pattern involving partial classes to implement a class that has settable properties to the assembly, but is read-only from the outside, something like
// This is just the non-working example to get the idea of what I want it to do…

Johann Studanski
- 1,023
- 12
- 19
0
votes
1 answer
Store data into Objects based on the input C#
I have to save data into different C# objects based on the input.
Based on the value of "productChoice" my program should save data to the corresponding class.
For example :
if productChoice = "auto" then the data shoud be set to AutoDataprefill…

BumbleBee
- 10,429
- 20
- 78
- 123
0
votes
1 answer
Property access modifiers with setters and getters
I have the following C# code:
class C
{
public int A { get; private set; }
}
How is the access modifier placed before the property type and name ('public' in this example) related to the specified access modifiers for the getters and setters?

Only One Stone
- 31
- 3
0
votes
3 answers
Question about automatic properties
what happens if you implement an automatic property
public string Foobar { get; set; }
and then code the corresponding variable
private string foobar = string.Empty;
Will the automatic property use this variable or does the compiler generate
an…

Viper
- 2,216
- 1
- 21
- 41
0
votes
2 answers
null exception with lists in c#
hey i am trying to work with a generic list in C# and for some reason after allocating memory for the list i am getting unhandeledNullException.
//edit
i found out what was my problem i did not use the properties currectly.
if lets say GeoInfo is…

Nadav
- 2,589
- 9
- 44
- 63
0
votes
1 answer
How long does an auto property last?
I could not find any information on how long an auto property will last in an application?
What I mean by that is do they keep their default value for the entire time the application is running?
ie, if I initialize an auto property at startup like…

KyloRen
- 2,691
- 5
- 29
- 59
0
votes
2 answers
Auto-properties with mutable objects
I'm trying to make properties for mutable objects. Is this a problem with Auto-properties? For example, the following code would allow for unwanted manipulation of the mutable object. How would I avoid this?
public class Mutable{
public int…

nostro
- 13
- 3
0
votes
1 answer
How to write a multi-line property in the auto-props section of the subversion config file?
What is the correct syntax?
[auto-props]
*.* = svn:ignore=bin
obj
or
[auto-props]
*.* = svn:ignore=bin;obj
or none? Is it possible to write multi-line properties in the config file?

Jader Dias
- 88,211
- 155
- 421
- 625