ASP.NET网站或ASP.NET Web应用程序?(ASP.NET Web Site or ASP.NET Web Application?)
当我在Visual Studio中启动一个新的ASP.NET项目时,我可以创建一个ASP.NET Web应用程序,或者我可以创建一个ASP.NET网站。
ASP.NET Web应用程序和ASP.NET网站有什么区别? 为什么我会选择一个呢?
根据我使用的Visual Studio版本,答案是否不同?
When I start a new ASP.NET project in Visual Studio, I can create an ASP.NET Web Application or I can create an ASP.NET Web Site.
What is the difference between ASP.NET Web Application and ASP.NET Web Site? Why would I choose one over other?
Is the answer different based on which version of Visual Studio I am using?
原文:https://stackoverflow.com/questions/398037
最满意答案
是的,你可以使用NSPointerFunctionsWeakMemory。 Facebook KVOController也使用该选项使用NSHashTable,请参阅KVOController
- (instancetype)init { self = [super init]; if (nil != self) { NSHashTable *infos = [NSHashTable alloc]; #ifdef __IPHONE_OS_VERSION_MIN_REQUIRED _infos = [infos initWithOptions:NSPointerFunctionsWeakMemory|NSPointerFunctionsObjectPointerPersonality capacity:0]; #elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED) if ([NSHashTable respondsToSelector:@selector(weakObjectsHashTable)]) { _infos = [infos initWithOptions:NSPointerFunctionsWeakMemory|NSPointerFunctionsObjectPointerPersonality capacity:0]; } else { // silence deprecated warnings #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" _infos = [infos initWithOptions:NSPointerFunctionsZeroingWeakMemory|NSPointerFunctionsObjectPointerPersonality capacity:0]; #pragma clang diagnostic pop } #endif _lock = OS_SPINLOCK_INIT; } return self; }
另外,为了更方便的方式,你可以使用
weakObjectsHashTable
返回一个新的散列表,用于存储对其内容的弱引用。
返回值使用选项NSHashTableZeroingWeakMemory和NSPointerFunctionsObjectPersonality并具有初始容量为0的新哈希表。
这份文件有点旧,但确实如此。 请参阅NSHipster NSHash表和NSMap表
NSHashTableZeroingWeakMemory: This option has been deprecated. Instead use the NSHashTableWeakMemory option
还请注意
NSHashTableWeakMemory等于NSPointerFunctionsWeakMemory
Yes, you can use NSPointerFunctionsWeakMemory. Facebook KVOController also use NSHashTable with that option, see KVOController
- (instancetype)init { self = [super init]; if (nil != self) { NSHashTable *infos = [NSHashTable alloc]; #ifdef __IPHONE_OS_VERSION_MIN_REQUIRED _infos = [infos initWithOptions:NSPointerFunctionsWeakMemory|NSPointerFunctionsObjectPointerPersonality capacity:0]; #elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED) if ([NSHashTable respondsToSelector:@selector(weakObjectsHashTable)]) { _infos = [infos initWithOptions:NSPointerFunctionsWeakMemory|NSPointerFunctionsObjectPointerPersonality capacity:0]; } else { // silence deprecated warnings #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" _infos = [infos initWithOptions:NSPointerFunctionsZeroingWeakMemory|NSPointerFunctionsObjectPointerPersonality capacity:0]; #pragma clang diagnostic pop } #endif _lock = OS_SPINLOCK_INIT; } return self; }
Also, for more convenient way, you can use
weakObjectsHashTable
Returns a new hash table for storing weak references to its contents.
Return Value A new hash table that uses the options NSHashTableZeroingWeakMemory and NSPointerFunctionsObjectPersonality and has an initial capacity of 0.
The document is a little bit old, but it is true. See NSHipster NSHashTable & NSMapTable
NSHashTableZeroingWeakMemory: This option has been deprecated. Instead use the NSHashTableWeakMemory option
Note also that
NSHashTableWeakMemory Equal to NSPointerFunctionsWeakMemory
相关问答
更多-
python中的弱引用(Weak References in python)[2023-09-24]
理论 引用计数通常是这样工作的:每次创建对象的引用时,它都会增加1,并且每当删除引用时,它都会减1。 弱引用允许您创建对不会增加引用计数的对象的引用。 python的垃圾收集器在运行时使用引用计数:引用计数为0的任何对象都将被垃圾收集。 您可以使用弱引用来处理昂贵的对象,或者避免引用循环(尽管垃圾回收器通常会自行完成)。 用法 这是一个演示其用法的实例: import weakref import gc class MyObject(object): def my_method(self): ... -
clojure中的弱引用(Weak References in clojure)[2022-04-22]
Clojure的主要负责人之一就是拥抱解决问题的主机平台。 考虑到这一点,不包装普通的Java弱哈希映射是很有意义的。 不要为了包装而包装 one of the guiding principals in Clojure is to embrace the host platform where it solves the problem. with that in mind it makes a lot of sense not to wrap the normal Java weak hash map. ... -
您可以使用弱引用来缓存,就像您所说的那样,就像软引用一样。 PhantomReferences有什么好处? 我只知道他们有两个严重的情况:首先,他们允许您确定何时从内存中删除对象。 事实上,他们是唯一确定这一点的方法。 这通常不是很有用,但在处理大图像等特定情况下可能会派上用场:如果确实知道应该对图像进行垃圾回收,则可以等到它实际上在尝试加载下一个图像之前,因此使可怕的OutOfMemoryError不太可能。 其次,PhantomReferences避免了最终化的一个基本问题:finalize()方法可以 ...
-
是的,你可以使用NSPointerFunctionsWeakMemory。 Facebook KVOController也使用该选项使用NSHashTable,请参阅KVOController - (instancetype)init { self = [super init]; if (nil != self) { NSHashTable *infos = [NSHashTable alloc]; #ifdef __IPHONE_OS_VERSION_MIN_REQUIRED _i ...
-
归档ARC中的弱参考(Zeroing Weak References in ARC)[2022-04-23]
这是正确的,但assign属性仍然被视为与以前一样,只有weak的是归零。 另一个值得注意的是,归零弱引用仅在Mac OS X≥10.7和iOS≥5中可用。而其余的ARC被反馈到10.6和iOS 4,这些操作系统的弱引用根本无法使用。 It's mostly right, but assign properties are still treated the same as they ever were, only weak ones are zeroing. Another caveat is that ... -
了解弱引用(Understanding Weak References)[2022-02-09]
不, innerMap是对innerMap引用的同一对象的强引用。 通过对outer的弱引用来初始化它不会改变它。 不会。当不再有任何实时,强烈的引用时, innerMap引用的对象将有资格获得GC。 它曾被某个类的实例变量引用,此后一直是GC'ed没有区别。 在outer.outerMap引用的同一个对象的另一个引用之外的存在outer.outerMap并不会阻止outer引用的对象本身是GC。 至于资源,你可以试试 理解弱引用 ,或 API文档 No. innerMap is a strong refe ... -
哈希表中的ARC弱引用(ARC weak references in hash table)[2022-07-25]
这个问题在几个月前发布,但为了记录,NSHashTable 确实删除了已发布的弱引用。 因此,要回答实际问题,不,您不需要定期迭代散列表。 This question was posted several months ago, but for the record, NSHashTable does remove released weak references. So to answer the actual question, no, you don't need to iterate over th ... -
两个对象都可能被垃圾收集; 来自弱引用对象的强烈参考被视为弱引用。 Both objects may be garbage-collected; a strong reference from a weakly-referenced object counts as a weak reference.
-
.NET中有弱引用吗?(Are there Weak References in .NET?)[2023-02-28]
是的,这里有一个通用的弱引用类。 MSDN>弱引用 Yes, there's a generic weak reference class. MSDN > Weak Reference -
.net中的弱引用(weak references in .net)[2023-10-18]
考虑两个级别的缓存。 因此,第一级中的对象用普通引用引用,然后在第二级中引用弱引用。 因此,如果你想从第一级到期你的对象,你可以把它放在第二级。 下次,当客户端尝试访问此对象时,如果有足够的内存对象将从第二级升级,但是如果内存不足并且收集了对象,则必须重新创建对象。 有时它会从昂贵的商店重新创建或检索,但在某些情况下,您将能够在第二级找到它。 Think about cache with 2 levels. So objects in the 1st level are referenced with no ...