F # Struct with Interface, C # metadata doesn't show inheritance from interface
So, strange problem, I have a structure and a record. Both implement the ITick interface, however when referenced to Tick in C #, the metadata does not inherit the interface. For the RedisTick record type, although the interface is inherited.
Am I missing 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
Recording
[<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
C # Metadata:
Writing 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); }
String 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);
}
+3
source to share