Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
4 votes
0 answers
79 views

Is there a technical reason C# doesn't have a property setter shorthand similar to object initializer, or is it just a design choice?

If I have an already-created object (e.g. a control on a form) and I want to initialize a number of properties, I have to do this: myObj.Details.Color = Colors.Red; myObj.Details.Name = "My Object"; ...
rory.ap's user avatar
  • 35.5k
12 votes
3 answers
3k views

Implicit conversion from char to single character string

First of all: I know how to work around this issue. I'm not searching for a solution. I am interested in the reasoning behind the design choices that led to some implicit conversions and didn't lead ...
pyrocumulus's user avatar
  • 9,300
0 votes
0 answers
1k views

Why explicit interface implementation [duplicate]

What is the rationale behind explicit interface implementation? What problem/feature does it solve? Or, put in other words, why .Net designer inserted explicit interface implementation in the ...
Gian Paolo's user avatar
  • 4,259
1 vote
1 answer
340 views

Why does conditional methods must have a return type of void?

We were writing some global exception handler for our API and we need to execute certain method only in Debug configuration and obviously conditional method is possible solution. What I saw however ...
kuskmen's user avatar
  • 3,775
7 votes
3 answers
136 views

What is the use of field initialisers in .NET(apart from readability)?

I am just trying to learn about field initializers. I ran into the error - field initializers cannot use non static field, method or prop. While hunting an answer for this I came across THIS post. ...
Social Developer's user avatar
3 votes
2 answers
479 views

Term to call a function with empty parameter

In functional programming, what is the correct name to call a function that accepts no arguments? For example: // 2 types of execute functions type Function = | UnitFunction of (unit -> unit) ...
MiP's user avatar
  • 6,492
3 votes
1 answer
91 views

Why does F# fail to support extending system type with its type abbreviation?

For example, if I try to extend int, with int is not the true name of the type, this code will fail: type int with member this.IsEven = this % 2 = 0 I must use System.Int32 instead: type System....
MiP's user avatar
  • 6,492
2 votes
1 answer
553 views

Does System.ValueType inherit from System.Object or no?

I am confused a bit, maybe I am looking at the wrong places, please enlighten me! I am looking at msdn's descpription of System.ValueType class, and it is showing the following in the Inheritance ...
DDan's user avatar
  • 8,326
1 vote
3 answers
307 views

Implicit chain constructor in .NET [closed]

Why is there no implicit chain constructor to the base class? What I mean? Let's look at the following classes: class Person { public String Name { get; set; } public Person(string name) ...
L.Trabacchin's user avatar
  • 1,620
4 votes
1 answer
447 views

Why Debug is different to Release in this specific and very simple case? [duplicate]

... and by different I don't mean performance, debug-ability candies and so on, I am meaning different programs (programs that for the same input gives different outputs). Take the following program: ...
Eric Javier Hernandez Saura's user avatar
6 votes
1 answer
1k views

Design reason why .NET does not have a conceptual (Fatal-)Error exception type? [closed]

Preliminary note: This question is not intended to bash on .NET, nor is intended to wage a discussing war if there is such a thing as a "Fatal Exception" - Java's designers clearly thought there are,...
Martin Ba's user avatar
  • 39.1k
0 votes
2 answers
89 views

Preventing inheritance of static member

Base: public abstract class systemClient : IDisposable { public static List<systemClient> Collection = new List<systemClient>(); [...] } derived class public class station : ...
Mark's user avatar
  • 419
2 votes
2 answers
240 views

Why is TimeSpan not a typedef of Int64?

System.TimeSpan class only has one non-static private field and that is internal long _ticks; So it only keeps ticks and performs all operations (Add, Subtract, TotalSeconds ...) and overloads ...
ahmet alp balkan's user avatar
7 votes
4 answers
1k views

Is it possible to add keyword to C# or VB.NET?

I know it might not be worth it but just for education purposes I want to know if there is a way to inject your own keywords to .NET languages. For example I thought it's good to have C++ asm keyword ...
Mohsen Sarkar's user avatar
14 votes
2 answers
17k views

C# readonly vs Java final

In Java, final means a variable can only be assigned to once, but that assignment can happen anywhere in the program. In C#, readonly means a field can only be assigned in a constructor, which, IMO, ...
MgSam's user avatar
  • 12.9k

15 30 50 per page