首页 \ 问答 \ ASP.NET网站或ASP.NET Web应用程序?(ASP.NET Web Site or ASP.NET Web Application?)

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
更新时间:2022-06-19 15:06

最满意答案

是的,你可以使用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 NSHash​Table & NSMap​Table

NSHashTableZeroingWeakMemory: This option has been deprecated. Instead use the NSHashTableWeakMemory option

Note also that

NSHashTableWeakMemory Equal to NSPointerFunctionsWeakMemory

相关问答

更多
  • 理论 引用计数通常是这样工作的:每次创建对象的引用时,它都会增加1,并且每当删除引用时,它都会减1。 弱引用允许您创建对不会增加引用计数的对象的引用。 python的垃圾收集器在运行时使用引用计数:引用计数为0的任何对象都将被垃圾收集。 您可以使用弱引用来处理昂贵的对象,或者避免引用循环(尽管垃圾回收器通常会自行完成)。 用法 这是一个演示其用法的实例: import weakref import gc class MyObject(object): def my_method(self): ...
  • 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 ...
  • 这是正确的,但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 ...
  • 不, innerMap是对innerMap引用的同一对象的强引用。 通过对outer的弱引用来初始化它不会改变它。 不会。当不再有任何实时,强烈的引用时, innerMap引用的对象将有资格获得GC。 它曾被某个类的实例变量引用,此后一直是GC'ed没有区别。 在outer.outerMap引用的同一个对象的另一个引用之外的存在outer.outerMap并不会阻止outer引用的对象本身是GC。 至于资源,你可以试试 理解弱引用 ,或 API文档 No. innerMap is a strong refe ...
  • 这个问题在几个月前发布,但为了记录,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.
  • 是的,这里有一个通用的弱引用类。 MSDN>弱引用 Yes, there's a generic weak reference class. MSDN > Weak Reference
  • 考虑两个级别的缓存。 因此,第一级中的对象用普通引用引用,然后在第二级中引用弱引用。 因此,如果你想从第一级到期你的对象,你可以把它放在第二级。 下次,当客户端尝试访问此对象时,如果有足够的内存对象将从第二级升级,但是如果内存不足并且收集了对象,则必须重新创建对象。 有时它会从昂贵的商店重新创建或检索,但在某些情况下,您将能够在第二级找到它。 Think about cache with 2 levels. So objects in the 1st level are referenced with no ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)