Linked Questions

55 votes
6 answers
118k views

I see this quiet often in C# documentation. But what does it do? public class Car { public Name { get; set; } }
naim5am's user avatar
  • 1,384
0 votes
2 answers
7k views

Consider the following code : public class Order { public int OrderID { get; set; } public DateTime OrderDate { get; set; } public decimal Total { get; set; } } I ...
JAN's user avatar
  • 22k
0 votes
2 answers
5k views

I have seen a singletone code that uses a function without parentheses. i wanted to know is there any difference between a function without parentheses and a function with parentheses that takes no ...
Parham's user avatar
  • 21
-1 votes
1 answer
4k views

Hello what is difference between this field: public string Name; And this property: public string Name{get;set;} I read this topic : What is the { get; set; } syntax in C#?
patrick star's user avatar
-5 votes
1 answer
281 views

using System; class Program { class Person { protected int Age {get; set;} protected string Name {get; set;} } class Student : Person { public Student(string nm) { ...
Siva Teja's user avatar
0 votes
1 answer
173 views

I have an strange comportement with my singleton class. public class HttpCommunicator{ public const int TYPEJSON = 1; private static HttpCommunicator; private bool TypeIsInit = false; ...
Leze's user avatar
  • 759
0 votes
1 answer
266 views

What is the difference between the following, and why would I choose the one above the other? public string MyProperty { get; set; } VS public string MyProperty { get { return _myProperty; } ...
Elmer's user avatar
  • 383
0 votes
1 answer
243 views

I am trying to set a variable in a class that I created. public class Star { public int starID { get; set; } public Vector3 position { get; set; } public string ...
Sean McKenna's user avatar
0 votes
0 answers
57 views

I'm fairly new to C# and I'm following this tutorial. I've reached the part about get and set of private instances (using theirs example) class Person { private string name; // field public string ...
CutePoison's user avatar
  • 5,544
5 votes
13 answers
4k views

I know in C# you can easily create accessors to a data type, for example, by doing the following: public class DCCProbeData { public float _linearActual { get; set; } public float ...
Ryan R's user avatar
  • 8,501
3 votes
4 answers
15k views

I am new to C# and am exploring the very basic of C# get and set properties. What I have found is, The get set accessor or modifier mostly used for storing and retrieving value from the private field. ...
Noor A Shuvo's user avatar
  • 2,875
3 votes
2 answers
2k views

Since your help with my first issue, I have made some great progress with the RPG I'm making for both educational and recreational purposes. Thank you all for that! In this post, I will be asking for ...
TheBattleCat's user avatar
1 vote
2 answers
3k views

Can I make a property in c# class that has no field, but I still can check the value and set it only if match? I mean something like this: public int Num { get; set if value > 0 &&...
Dvir's user avatar
  • 17
0 votes
2 answers
2k views

I'm looking to multiply a value in the set backing field in C# (for an ASP.NET MVC application). I'm doing this to avoid issues with dividing floating point numbers and therefore the properties are ...
Gareth's user avatar
  • 5,263
1 vote
1 answer
4k views

I'm creating a Pokemon-type game in Visual Studio. I'm working on the Inventory form right now. My question is can I use a public count variable as a way to keep track of the inventory? Setting ...
Tarheel81's user avatar

15 30 50 per page