I am programming in C # .NET. Is it possible to interrupt the established procedure of a class property without exception?
Here is what I want to do ...
public int RandomProperty { set { DialogResult answer = new DialogResult(); answer = MessageBox.Show("This process could take up to 5 min. Are you sure you want to continue?"); if(answer = DialogResult.No) CancelSet // Can I do something similar here? else { ...Do set procedure } } }
I donβt think I can use a method (instead of a property) because I set this value using the grid property.
. -. . , , , . . .
, . , , ? , "". , , , , .
, , .
, , , " , ", " " " , ". "", , . , , , .
, - . , .
IMO, - , set , . ( -) , set, . , :
set
public bool TrySetRandomProperty(SomeType value) { ... }
true false, , . ; , , , ?
true
false
. ? ?
, , , .
, .
.
. , , , "cancel" .
Source: https://habr.com/ru/post/1733224/More articles:C # exception when calling a callback function - c #MySQL Get the latest date in each month from a date column - dateAutomagic output fields in CakePHP? - crudInitializing Glassfish Singleton bean twice - javacan i use user.IsInRole without using membership? - asp.netBig jasper report in Excel causes corrupted file - excelAdding an entry to a python tuple - pythonHelp create a unit test header for a test answer, in particular Cache-Control, in determining whether caching is disabled or not - cachingLayered tiled paint - javaRemove extra spaces from the string (in place) - cAll Articles