我正在將diffuculties封裝在轉換一小段代碼的過程中。如果我能得到一些很棒的指導。該代碼目前在C中,而我正試圖轉換爲C#。轉換數據結構
typedef struct sched_pmt *sched_pmt_ptr;
typedef struct sched_pmt
{
unsigned period_num;
double interest;
double principal;
double advanced_pmt;
double total_pmt;
double balance;
}
sched_pmt;
我想我得到sched_pmt下面,但不確定如何做指針。
public class sched_pmt
{
private uint period_num { get; set; }
double interest { get; set; }
double principal { get; set; }
double advanced_pmt { get; set; }
double total_pmt { get; set; }
double balance { get; set; }
}
C代碼實例。
sched_pmt_ptr pmtsched = NULL;
pmtsched->period_num = s++;
pmtsched->interest = pmt_int;
pmtsched->principal = prin;
pmtsched->advanced_pmt = adv_pmt;
pmtsched->total_pmt = pmt + adv_pmt;
pmtsched->balance = pv;
pmtsched++;
我可以使用pmtsched ++在C#中更新結構嗎?
難道你不能只是運行代碼,看看你是否得到相同的結果? –
我如何運行它,如果我沒有完成指針...除非在C#中不需要指針?因此,你可能已經回答了我的問題 – Master