📜 ⬆️ ⬇️

C #: Etudes, part 6

A lot of time has passed since the last etude, but I hope that habrayuzer did not have time to lose interest in C #.

This time the task is quite simple, but it can be useful for newcomers to Sharp. There is the following code:

var x = new T(...);
var y = new T(...);
Console.WriteLine("{0}", object.ReferenceEquals(x, y));


where T is some type, ... are the parameters of the constructor.
Find such T and such parameters so that this code will display True (or an equivalent, depending on the language of the installed framework).
')
new clean in no case possible. Also, you cannot call any methods on the newly created object. In x and y, exactly the value returned by the new operator is saved. All code should be managed and secure, and of course, you should not add new Console.WriteLine statements.

I know for now two solutions.

Source: https://habr.com/ru/post/93875/


All Articles