Home >Backend Development >C#.Net Tutorial >The difference between @synthesize and @dynamic

The difference between @synthesize and @dynamic

高洛峰
高洛峰Original
2016-12-13 09:19:531349browse

After declaring the property attribute, there are 2 implementation options

@synthesize

During the compiler, let the compiler automatically generate getter/setter methods.

When there is a custom storage or retrieval method, the customization will block the automatic generation of the method

@dynamic

Tell the compiler not to automatically generate getter/setter methods to avoid warnings during compilation

Then by Implement your own access methods

or access methods to dynamically create bindings at runtime: Mainly used when CoreData implements NSManagedObject subclasses, and the Core Data framework dynamically generates subclass attributes when the program is running


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:dynamic (C# reference)Next article:dynamic (C# reference)