class Human
{
public string Name { get; set }
}
class Human
{
private string _name;
public string GetName()
{
return this._name;
}
public void SetName(string value)
{
this._name = value;
}
}
class Human
{
private string _phone;
public string Phone
{
get => "Human phone" + this._phone;
set =>
{
this._phone = value;
if (value[0] != '+') this._phone = "+" + this._phone;
}
}
}
class Human
{
private string _phone;
public string GetPhone()
{
return "Human phone: " + this._phone;
}
public void SetPhone(string value)
{
this._phone = value;
if (value[0] != '+') this._phone = "+" + this._phone;
}
}
var human = new Human();
human.Name = "John";
Console.WriteLine(human.Name);
Human human = new Human();
human.SetName("John");
Console.WriteLine(human.GetName());
// Root myDeserializedClass = JsonConvert.DeserializeObject<Root>(myJsonResponse);
public class Hotel {
public int id { get; set; }
public int countryId { get; set; }
public string country { get; set; }
public string countryUrl { get; set; }
public int regionId { get; set; }
public string region { get; set; }
public string regionUrl { get; set; }
public string hotelType { get; set; }
public string name { get; set; }
public string comment { get; set; }
public string imageFolder { get; set; }
public string imageHotel { get; set; }
public string minPrice { get; set; }
public bool showHalfPrice { get; set; }
public string minPriceCurrency { get; set; }
public List<object> restTypes { get; set; }
public bool tour3D { get; set; }
public string video { get; set; }
public bool tezRecommend { get; set; }
public bool tezPriority { get; set; }
public bool tezOnly { get; set; }
public string price { get; set; }
}
public class Root {
public Hotel[] hotels { get; set; }
}
var data = JsonConvert.DeserializeObject<Root>(jsonText);
var names = data.hotels.Select(x=>x.name).ToArray();
if (Score.scoreAmount >= 30)
{
if (PlayerPrefs.HasKey(CostWin, 1))
{
if (PlayerPrefs.GetInt(buy) == 0)
{
Score.scoreAmount -= 30;
PlayerPrefs.SetInt("coins", Score.scoreAmount);
CostW.SetActive(false);
PlayerPrefs.SetInt("buy", 1);
}
}
else
{
Score.scoreAmount -= 30;
PlayerPrefs.SetInt("coins", Score.scoreAmount);
CostW.SetActive(false);
PlayerPrefs.SetInt("buy", 1);
}
}
//1 файл
namespace File1
{
public class Class
{
public static string Data ;//переменные с которыми необходимо работать
}
}
using File1;
//подключение пространства имен необходимого //файла
namespace ConApp{
class Program(){
void Main(){
Class.Data="Hellow word";//внести необходимые значения
Console.Write(Class.Data);//либо получить значение переменной
}
}
}
int result;
switch(something) {
case "a":
result = 1;
break;
case "b":
result = 2;
break;
default:
result = 3;
break;
}
var result = something switch {
"a" => 1,
"b" => 2,
_ => 3
}