var word = db.Words.Include(x => x.LearnDay).Where(p => p.Id == testId).FirstOrDefault();
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace laba3
{
public class Vektor
{
public readonly double x, y, z;
public Vektor(double x, double y, double z)
{
this.x = x;
this.y = y;
this.z = z;
}
//summa
public Vektor Add(Vektor V)
{ return new Vektor(this.x + V.x, this.y + V.y, this.z + V.z); }
//raznost
public Vektor Razn(Vektor V)
{ return new Vektor(this.x - V.x, this.y - V.y, this.z - V.z); }
public double Length()
{ return Math.Sqrt(x * x + y * y + z * z); }
public double Length(Vektor V)
{ return (Math.Sqrt(x * x + y * y + z * z) * Math.Sqrt(x * x + y * y + z * z));}
//skalarnoe proizvedenie
public virtual double Skalar(Vektor V)
{ return x * this.x + y * this.y + z * this.z; }
//umnozenie na skalar a
public double Uskalar()
{
double a = 1;
return a * this.x + a * this.y + a * this.z;
}
//sravnenie
public bool Equals(Vektor V)
{
if (!(V is Vektor))
{ return false; }
return base.Equals(V);
}
public override string ToString()
{
return $"{x} {y} {z}";
}
}
//класс наследник +переопределение
class Naslednik : Vektor
{
public override double Skalar(Vektor V)
{
base.Skalar(V);
return 2*x * this.x + 2*y * this.y + 2*z * this.z; ;
}
}
public class Demo
{
public static void Main()
{
Vektor A = new Vektor(10, 7, 9);
Vektor B = new Vektor(3, 5, 7);
Console.WriteLine("A vektor: x={0},y={1},z={2}", A.x, A.y, A.z);
Console.WriteLine("B vektor: x={0},y={1},z={2}", B.x, B.y, B.z);
Console.WriteLine($"Summa : {A.Add(B)}");
Console.WriteLine($"Raznost: {A.Razn(B)}");
Console.WriteLine($"The scalar *****: {A.Skalar(B)}");
Console.WriteLine("Dlina A : {0} ", A.Length());
Console.WriteLine("Dlina B : {0} ", B.Length());
Console.WriteLine($"Umnozenie na skalar-Vektor A: {A.Uskalar()}");
Console.WriteLine($"Umnozenie na skalar-Vektor B: {B.Uskalar()}");
Console.WriteLine($"Vektor v kvadrate-Vektor A: {A.Length(B)}");
Console.WriteLine($"Ravni li: {A.Equals(B)}");
Console.WriteLine("Press Enter...");
Console.ReadLine(); // Чтобы программа сразу не закрылась
}
}
}
public class VmWord
{
public int Id { get; set; }
public string Name { get; set; }
public string Localization { get; set; }
[NotMapped]
public Dictionary<string, string> Localizations
{
get { return JsonConvert.DeseriazeObject<Dictionary<string, string>>(Localization.ToList()); }
set { Localization = JsonConvert.SerializeObject(value); }
}
}
public class VmWord
{
public int Id { get; set; }
public string Name { get; set; }
public virtual List<string> Localizations { get; set; }
}
public class Localization
{
public int Id { get; set; }
public string Key { get; set; }
public string Value { get; set; }
public virtual VmWord VmWord { get; set; }
}
<connectionStrings>
<add name="DB1Connection" connectionString="data source=(local);initial catalog=myDB1;" />
<add name="DB2Connection1" connectionString="data source=(local);initial catalog=myDB2;" />
<add name="DB3Connection1" connectionString="data source=(local);initial catalog=myDB3;" />
</connectionStrings>
connectionStringName = "DB3Connection1";
public class MyDbContext : DbContext
{
public MyDbContext(string connectionStringName) : base(connectionStringName)
{ }
}
А как можно преобразовать строку в Int и в итоге получить 9 в функции
bd.User.OrderBy(x => x.Id).ElementAt(5);
bd.User.OrderBy(x => x.Id).ToList().FindIndex(x => x.Name == "Vasya");
Select Login from Accounts WHERE ...
не может дать Вам скалярное значение. Нужно либо запрос другой писать, либо вызывать другой метод на command. if (item.HasAttribute("data-previewurl"))
{
list.Add(item.GetAttribute("data-previewurl"));
}
"mysite.ru/" + item.GetAttribute("data-previewurl")
Res = JsonConvert.DeserializeObject<RootObject>(Response);
2. Список нужно указывать с конкретным типом, иначе это будет опять список objectpublic List<Sm> sms { get; set; }
Res.sms[0].text
var Res = JsonConvert.DeserializeObject<RootObject>(Response);
var strTextSMS = Res.sms[0].text; // индекс 0 для примера