public Property(PropertyInfo prop) : base(prop.Name, prop.PropertyType) { if (CanRead = prop.CanRead) { Methodnames.Add(prop.GetMethod.Name); } if (CanWrite = prop.CanWrite) { Methodnames.Add(prop.SetMethod.Name); } if (prop.Name == "Item" && !TypeIndex.Equals(TypeIndex.Object) && prop.GetIndexParameters().Length > 0) { IsIndex = true; } }
public override void Desc(StreamWriter sw, int space) { var pre = GetPrefixSpace(space); string pars = string.Join(", ", Params.Select(p => p.ToString())); if (IsStatic) { sw.WriteLine($"{pre}@staticmethod"); } else if (Params.Count > 0) { pars = "self, " + pars; } else { pars = "self"; } if (Name == "__init__") { sw.Write($"{pre}def {Name}({pars}) -> {TypeIndex.Name}:"); } else if (TypeIndex.Equals(TypeIndex.None)) { sw.Write($"{pre}def {Name}({pars}):"); } else { sw.Write($"{pre}def {Name}({pars}) -> {TypeIndex.Fullname}:"); } if (IsExtension) { sw.WriteLine(); sw.WriteLine($"{pre} \"\"\"Extension from: {DeclaringType}\"\"\""); } else { sw.WriteLine("..."); } }