我必须上课。让我们说发票和临时发票。 两者具有相同的属性(全部相同)。假设我使用发票类创建了一个对象。我可以将该对象转换为我使用 tempInvoice 创建的另一个对象吗??
例如:
Invoice invoiceobj= getInvoice(int? id) //a method return a invoice object
TempInvoice tempInvoiceObject = invoiceobj// (Need to do it and fill tempInvoice by Invoice Values.even as a new memory location o set by reference.)
最佳答案
除非 Invoice
派生自 TempInvoice
。
关于c# - 将一个对象转换到另一个对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3641951/