TypeLite 프레임 워크를 탐색하여 C#으로 코드를 작성한 다음 (클라이언트와 서버 측에서 동일한 코드가 필요하므로) javascript 파일을 생성 할 수 있습니다.Typelite에 생성 된 TypeScript 파일에 메서드가 없습니다.
모든 클래스가 인터페이스로 변환 될 때 처음 성공했습니다. 그러나, 나는 방법을 변환에 붙어있다. TypeLite는 Typescript로 변환하는 방법을 지원합니까? TypeLite는 POCO 객체를 지원하므로 이상적인 방법으로 Typescript 메서드를 생성 할 수 있어야합니다.
declare module MvcApplication4.Controllers {
interface Person {
Name: string;
Addresses: MvcApplication4.Controllers.Address[];
dict: System.Collections.Generic.KeyValuePair<number, string>[];
}
interface Address {
Street: string;
}
interface Concrete {
person: MvcApplication4.Controllers.Person;
}
interface Employee extends MvcApplication4.Controllers.Person {
Salary: number;
}
}
declare module System.Collections.Generic {
interface KeyValuePair<TKey, TValue> {
Key: TKey;
Value: TValue;
}
}
공지 사항 : 나는 GetName 함수에서 얻을 해달라고
public class Person
{
public string Name { get; set; }
public List<Address> Addresses { get; set; }
public Dictionary<int, string> dict { get; set; }
public string GetName()
{
return Name + Addresses.ToString();
}
}
public class Concrete
{
public Person person { get; set; }
public string name;
public Concrete()
{
person = new Person();
name = person.GetName();
}
}
public class Employee : Person
{
public decimal Salary { get; set; }
}
을 그리고 이것은 내가 무엇을 얻을 수 있습니다 : 여기
내가 얻을 내가 실행하려고하고있는 샘플 코드와 출력 생성 된 ts 파일 :(
감사합니다. Lukas. 그래서 C# 메서드를 대응하는 typescript/javascript로 변환 할 수있는 다른 프레임 워크를 검색해야합니다. ( – letsc
http://scriptsharp.com에 관심이있을 수 있습니다 - JavaScript로 C# 코드를 컴파일합니다. –