R
R
Rostislav Olshevsky2014-01-27 23:01:23
.NET
Rostislav Olshevsky, 2014-01-27 23:01:23

Reference types [C#, .NET 4.5]

Hello.
I decided to work in the "How does it work?" mode.
I came across problems for which I can not find answers in the book.
1) Why is string a reference type? And then, judging by its behavior, it is a "value type" ... PS: If possible, in more detail and with examples.
2) Where to find C# coding standards. As we know PHP has PHP-FIG -> PSR-0, PSR-1, PSR-2, PSR-3, PSR-4... For example, in PSR-2 we are told about the Coding Style Guide. Here is something similar I would like to see for C#.
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Mikhail Doshevsky, 2014-01-27
@DEA7H


Why is string a reference type?
So decided the developers of the language.
And then judging by his behavior, he is a "value type"
What behavior are you talking about? Strings in C# are immutable, every method that "changes" a string actually creates a new one and returns it. Perhaps this is misleading you.
Where to find C# coding standards.
If you are talking about the standard (specification) of the language, then here:
https://www.google.ru/#newwindow=1&q=C%23+standard...

D
Dmitry Guketlev, 2014-01-27
@Yavanosta

stackoverflow.com/questions/636932/in-c-why-is-str...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question