public static void Main(string[] args) { House house = new House { Name="house"}; Display(house); //UpCasting Stock msft = new Stock(); Asset a = msft; if (a == msft) Console.WriteLine("Identical"); Console.WriteLine(a.Name); //Console.WriteLine(a.SharesOwned); //Error //downcasting and as operator Asset asset = new Asset(); //Stock stock = (Stock)asset; // this will fail at runtime Stock stock = asset as Stock; // this will not fail but return null and will not give actual casting error if (stock != null) Console.WriteLine(stock); else Console.WriteLine("stock object is null"); //is operator if (asset is Stock) Console.WriteLine("a is stock"); else Console.WriteLine("a is not stock"); //virtual Console.Read(); }
static void Main(string[] args) { using (ColuClient client = new ColuClient()) { var address = client.GetAddressAsync().Result; var stake = new GetStakeHoldersRequest() { id = "1" }; stake.Params.AssetId = "Ua9V5JgADia5zJdSnSTDDenKhPuTVc6RbeNmsJ"; stake.Params.numConfirmations = "0"; var x = client.GetStakeHoldersAsync(stake).Result; Asset asset = new Asset() { amount = 1, divisibility = 0 }; //asset.amount = 1; //asset.divisibility = 0; //asset.issueAddress = "16mftBEkJgGpZdXx2Yh6cP7qbSa8cuPJJb"; MetaData metadata = new MetaData(); // { key = "Description", value = "Membership" }; metadata.Decription = "Annual Membership"; asset.metadata = metadata; Transfer pud = new Transfer() { amount = 1 }; //address = "13r7hhidTLHo1tpu9aWxCvQx1FgKGbsJPv", asset.transfer.Add(pud); To pudx = new To() { amount = 1, address = "13r7hhidTLHo1tpu9aWxCvQx1FgKGbsJPv" }; SendAssetRequest request = new SendAssetRequest(); request.param = asset; request.to.Add(pudx); var actual = client.SendAssetAsync(request).Result; } }
public static void Display(Asset asset) { Console.WriteLine(asset.Name); }