So, bizarre issue I've got a struct and a record. Both implement the ITick interface, however when referencing Tick in C# the metadata shows no inheritance from the interface. For the RedisTick record type though the interface is inherited.
Have I missed something in my code / is this a bug / what's wrong with it?
Interface
type ITick =
abstract Symbol : string
abstract Date : DateTime
abstract Price : Decimal
abstract Volume : int
Struct
type Tick(symbol : string, date : DateTime, price : Decimal, volume : int) =
struct
member this.Symbol = symbol
member this.Date = date
member this.Price = price
member this.Volume = volume
interface ITick with
member this.Symbol = this.Symbol
member this.Date = this.Date
member this.Price = this.Price
member this.Volume = this.Volume
end
Record
[<CLIMutable>]
type RedisTick =
{ Symbol : string
Date : DateTime
Price : Decimal
Volume : int }
interface ITick with
member this.Symbol = this.Symbol
member this.Date = this.Date
member this.Price = this.Price
member this.Volume = this.Volume
Record in C#
[Microsoft.FSharp.Core.CLIMutableAttribute] [Microsoft.FSharp.Core.CompilationMappingAttribute]
public sealed class RedisTick : IEquatable<RedisTick>, IStructuralEquatable, IComparable<RedisTick>, IComparable, IStructuralComparable, ITick {
public RedisTick();
public RedisTick(string symbol, DateTime date, decimal price, int volume);
[Microsoft.FSharp.Core.CompilationMappingAttribute]
public DateTime Date { get; set; }
[Microsoft.FSharp.Core.CompilationMappingAttribute]
public decimal Price { get; set; }
[Microsoft.FSharp.Core.CompilationMappingAttribute]
public string Symbol { get; set; }
[Microsoft.FSharp.Core.CompilationMappingAttribute]
public int Volume { get; set; }
[CompilerGenerated]
public sealed override int CompareTo(object obj);
[CompilerGenerated]
public sealed override int CompareTo(RedisTick obj);
[CompilerGenerated]
public sealed override int CompareTo(object obj, IComparer comp);
[CompilerGenerated]
public sealed override bool Equals(object obj);
[CompilerGenerated]
public sealed override bool Equals(RedisTick obj);
[CompilerGenerated]
public sealed override bool Equals(object obj, IEqualityComparer comp);
[CompilerGenerated]
public sealed override int GetHashCode();
[CompilerGenerated]
public sealed override int GetHashCode(IEqualityComparer comp); }
Struct in C#
[Microsoft.FSharp.Core.CompilationMappingAttribute]
public struct Tick : IEquatable<Tick>, IStructuralEquatable, IComparable<Tick>, IComparable, IStructuralComparable
{
public Tick(string symbol, DateTime date, decimal price, int volume);
public DateTime Date { get; }
public decimal Price { get; }
public string Symbol { get; }
public int Volume { get; }
[CompilerGenerated]
public sealed override int CompareTo(object obj);
[CompilerGenerated]
public sealed override int CompareTo(Tick obj);
[CompilerGenerated]
public sealed override int CompareTo(object obj, IComparer comp);
[CompilerGenerated]
public sealed override bool Equals(object obj);
[CompilerGenerated]
public sealed override bool Equals(Tick obj);
[CompilerGenerated]
public sealed override bool Equals(object obj, IEqualityComparer comp);
[CompilerGenerated]
public sealed override int GetHashCode();
[CompilerGenerated]
public sealed override int GetHashCode(IEqualityComparer comp);
}
解决了VS2015 RC它已经修复!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.