I am using LinqPad and I was looking at the IL code (compiler optimization enabled) generated for the following interface and a class that implements the interface:
public interface IStockService { [OperationContract] double GetPrice(string ticker); } public class StockService : IStockService { public double GetPrice(string ticker) { return 93.45; } }
IL Code:
IStockService.GetPrice: StockService.GetPrice: IL_0000: ldc.r8 CD CC CC CC CC 5C 57 40 IL_0009: ret StockService..ctor: IL_0000: ldarg.0 IL_0001: call System.Object..ctor IL_0006: ret
Surprisingly, I do not see any IL code for the interface. Is this because of how LinqPad works, or does the C # compiler treat interfaces differently?
source share