欢迎光临
我们一直在努力

字节跳动请教 MongoDB 驱动中的一段继承代码含义

程序员面试经验

hjahgdthab750

using MongoDB.Driver; using System;  /// <summary> /// The result of a delete operation. /// </summary> public abstract class DeleteResult { 	/// <summary> 	/// The result of an acknowledged delete operation. 	/// </summary> 	public class Acknowledged : DeleteResult 	{ 		private readonly long _deletedCount;  		/// <inheritdoc /> 		public override long DeletedCount => _deletedCount;  		/// <inheritdoc /> 		public override bool IsAcknowledged => true;  		/// <summary> 		/// Initializes a new instance of the <see cref="T:MongoDB.Driver.DeleteResult.Acknowledged" /> class. 		/// </summary> 		/// <param name="deletedCount">The deleted count.</param> 		public Acknowledged (long deletedCount); 	}  	/// <summary> 	/// The result of an unacknowledged delete operation. 	/// </summary> 	public class Unacknowledged : DeleteResult 	{ 		private static Unacknowledged __instance = new Unacknowledged ();  		/// <summary> 		/// Gets the instance. 		/// </summary> 		public static Unacknowledged Instance => __instance;  		/// <inheritdoc /> 		public override long DeletedCount { 			get; 		}  		/// <inheritdoc /> 		public override bool IsAcknowledged => false;  		private Unacknowledged (); 	}  	/// <summary> 	/// Gets the deleted count. If IsAcknowledged is false, this will throw an exception. 	/// </summary> 	public abstract long DeletedCount { 		get; 	}  	/// <summary> 	/// Gets a value indicating whether the result is acknowledged. 	/// </summary> 	public abstract bool IsAcknowledged { 		get; 	}  	internal static DeleteResult FromCore (BulkWriteResult result); }  

上面的 Acknowleged 继承于 DeleteResult
可以是为啥要写到 DeleteResult 之中?岂不是造成循环了?

请教 notion 这种格式如何弄?

ZHXZHX: 网址: https://youthce.com/B-a7352566cc3c4141891195bc18c30af0 想像上面的图片格式一样,利用 notion 制作一个简单的网页书签整理,替代书签同步功能,顺便整合一些不常用的书签。 但原网址限制了模板复制,不能套用。 刚接触 notion,一开始以为是 table,上网搜索一番,找不到方法…

请教 chrome 播放音视频突然没有声音了怎么办

futou:平台: win10 1909 chrome: 正式版 85.0.xxx 64bit chrome 昨天开始突然没有声音,网上搜索发现很多相似情况。 未静音,edge 浏览器及其它软件有声音。 重启 windows audio 服务后可以短时间内解决 chrome 的问题,换个视频就又不行了。 重置 setting 、更新和重装解决不了 chrom…

MongoDb C#驱动程序通过一次原子操作即可更新多个文档 – c#

我想问你下面的代码是否将在一个原子操作中执行。我正在使用mongodb c#驱动程序。该方法的输入是我要更新的对象的ID列表。public void Update(IEnumerable<string> ids) { var query = Query<T>.Where(t => ids.Contains(t.Id)); var…

[请教] Docker 容器如何与主机同网段其它主机互通?

xuerui911:我最近在学习大数据,Hadoop Zookeeper Hive Flume Kafka HBase 等等,需要同时开 5 个 VMWare 虚拟机,5 个虚拟机和主机 Windows 的 IDEA 互相访问。笔记本风扇起飞,风扇爆炸吵。我查到 Docker 是更轻量化的虚拟化技术,就简单学习了 Docker 。我理解 Docker0 所谓…

将谓词<T>转换为Func <T,bool> – c#

我有一个包含成员Predicate的类,希望在Linq表达式中使用该类:using System.Linq; class MyClass { public bool DoAllHaveSomeProperty() { return m_instrumentList.All(m_filterExpression); } private IEnumerable&…

赞(0)
未经允许不得转载: 京大飞辅助网程序员面试-区块链javago面经 » 字节跳动请教 MongoDB 驱动中的一段继承代码含义

相关推荐

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址