Start a new topic

C# Bindings As Interfaces

I am wondering what are the PROS and CONS for defining C# bindings as interfaces instead of classes..


 

	[Js(Name = "Object", Extern = true)]
	public interface ModalOptions
	{
		Union<boolean, string> backdrop { get; set; }
		boolean keyboard { get; set; }
		boolean show { get; set; }
		string remote { get; set; }
	}


VS

	[Js(Name = "Object", Extern = true)]
	public class ModalOptions
	{
		Union<boolean, string> backdrop { get; set; }
		boolean keyboard { get; set; }
		boolean show { get; set; }
		string remote { get; set; }
	}

 

The main reason i am even looking to using as interfaces is because of the MULTIPLE Sub-classes defined on the TypeScript Interface... Since you can only subclass 1 base class (but have as many interfaces on it) interfaces seems natural fit... also since typescript actually defines interfaces... Why not uses C# interfaces (except for static classes of course)...


In JQuery TypeScript for Example:



 

	interface JQueryEventObject extends BaseJQueryEventObject, JQueryInputEventObject, JQueryMouseEventObject, JQueryKeyEventObject{
	}


can be this in C#

[Js(Name="Object", Extern=true)]
	public interface JQueryEventObject : BaseJQueryEventObject, JQueryInputEventObject, JQueryMouseEventObject, JQueryKeyEventObject
	{
	}

 



Login or Signup to post a comment