Skip to content

Commit 229b9f1

Browse files
author
rstam
committed
CSHARP-933: Removed obsolete ReadFrom and WriteTo methods from BsonDocument.
1 parent 82c4b21 commit 229b9f1

File tree

1 file changed

+0
-86
lines changed

1 file changed

+0
-86
lines changed

src/MongoDB.Bson/ObjectModel/BsonDocument.cs

Lines changed: 0 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -369,53 +369,6 @@ public static BsonDocument Parse(string json)
369369
}
370370
}
371371

372-
/// <summary>
373-
/// Reads a BsonDocument from a BsonReader.
374-
/// </summary>
375-
/// <param name="bsonReader">The BsonReader.</param>
376-
/// <returns>A BsonDocument.</returns>
377-
[Obsolete("Use BsonSerializer.Deserialize<BsonDocument> instead.")]
378-
public static new BsonDocument ReadFrom(BsonReader bsonReader)
379-
{
380-
return BsonSerializer.Deserialize<BsonDocument>(bsonReader);
381-
}
382-
383-
/// <summary>
384-
/// Reads a BsonDocument from a byte array.
385-
/// </summary>
386-
/// <param name="bytes">The byte array.</param>
387-
/// <returns>A BsonDocument.</returns>
388-
[Obsolete("Use BsonSerializer.Deserialize<BsonDocument> instead.")]
389-
public static BsonDocument ReadFrom(byte[] bytes)
390-
{
391-
return BsonSerializer.Deserialize<BsonDocument>(bytes);
392-
}
393-
394-
/// <summary>
395-
/// Reads a BsonDocument from a stream.
396-
/// </summary>
397-
/// <param name="stream">The stream.</param>
398-
/// <returns>A BsonDocument.</returns>
399-
[Obsolete("Use BsonSerializer.Deserialize<BsonDocument> instead.")]
400-
public static BsonDocument ReadFrom(Stream stream)
401-
{
402-
return BsonSerializer.Deserialize<BsonDocument>(stream);
403-
}
404-
405-
/// <summary>
406-
/// Reads a BsonDocument from a file.
407-
/// </summary>
408-
/// <param name="filename">The name of the file.</param>
409-
/// <returns>A BsonDocument.</returns>
410-
[Obsolete("Use BsonSerializer.Deserialize<BsonDocument> instead.")]
411-
public static BsonDocument ReadFrom(string filename)
412-
{
413-
using (var stream = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.None))
414-
{
415-
return BsonSerializer.Deserialize<BsonDocument>(stream);
416-
}
417-
}
418-
419372
// public methods
420373
/// <summary>
421374
/// Adds an element to the document.
@@ -1231,45 +1184,6 @@ public virtual bool TryGetValue(string name, out BsonValue value)
12311184
}
12321185
}
12331186

1234-
/// <summary>
1235-
/// Writes the document to a BsonWriter.
1236-
/// </summary>
1237-
/// <param name="bsonWriter">The writer.</param>
1238-
[Obsolete("Use BsonSerializer.Serialize<BsonDocument> instead.")]
1239-
public new void WriteTo(BsonWriter bsonWriter)
1240-
{
1241-
BsonSerializer.Serialize(bsonWriter, this);
1242-
}
1243-
1244-
/// <summary>
1245-
/// Writes the document to a Stream.
1246-
/// </summary>
1247-
/// <param name="stream">The stream.</param>
1248-
[Obsolete("Use BsonSerializer.Serialize<BsonDocument> instead.")]
1249-
public void WriteTo(Stream stream)
1250-
{
1251-
using (var bsonWriter = new BsonBinaryWriter(stream))
1252-
{
1253-
BsonSerializer.Serialize(bsonWriter, this);
1254-
}
1255-
}
1256-
1257-
/// <summary>
1258-
/// Writes the document to a file.
1259-
/// </summary>
1260-
/// <param name="filename">The name of the file.</param>
1261-
[Obsolete("Use BsonSerializer.Serialize<BsonDocument> instead.")]
1262-
public void WriteTo(string filename)
1263-
{
1264-
using (FileStream stream = new FileStream(filename, FileMode.Create, FileAccess.Write))
1265-
{
1266-
using (var bsonWriter = new BsonBinaryWriter(stream))
1267-
{
1268-
BsonSerializer.Serialize(bsonWriter, this);
1269-
}
1270-
}
1271-
}
1272-
12731187
// private methods
12741188
private void RebuildDictionary()
12751189
{

0 commit comments

Comments
 (0)