SourceText.From 方法

定义

重载

From(String, Encoding, SourceHashAlgorithm)

从字符串中的文本构造一个 SourceText

From(Stream, Encoding, SourceHashAlgorithm, Boolean)
From(TextReader, Int32, Encoding, SourceHashAlgorithm)

从字符串中的文本构造一个 SourceText

From(Byte[], Int32, Encoding, SourceHashAlgorithm, Boolean)
From(Stream, Encoding, SourceHashAlgorithm, Boolean, Boolean)

从流内容构造。SourceText

From(Byte[], Int32, Encoding, SourceHashAlgorithm, Boolean, Boolean)

从字节数组构造 a SourceText

From(String, Encoding, SourceHashAlgorithm)

Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs

从字符串中的文本构造一个 SourceText

public static Microsoft.CodeAnalysis.Text.SourceText From (string text, System.Text.Encoding encoding = default, Microsoft.CodeAnalysis.Text.SourceHashAlgorithm checksumAlgorithm = Microsoft.CodeAnalysis.Text.SourceHashAlgorithm.Sha1);
public static Microsoft.CodeAnalysis.Text.SourceText From (string text, System.Text.Encoding? encoding = default, Microsoft.CodeAnalysis.Text.SourceHashAlgorithm checksumAlgorithm = Microsoft.CodeAnalysis.Text.SourceHashAlgorithm.Sha1);
static member From : string * System.Text.Encoding * Microsoft.CodeAnalysis.Text.SourceHashAlgorithm -> Microsoft.CodeAnalysis.Text.SourceText
Public Shared Function From (text As String, Optional encoding As Encoding = Nothing, Optional checksumAlgorithm As SourceHashAlgorithm = Microsoft.CodeAnalysis.Text.SourceHashAlgorithm.Sha1) As SourceText

参数

text
String

文本。

encoding
Encoding

从中读取或要保存到的文件 text 的编码。 null 如果未指定编码,则为 如果未指定编码,则生成的结果 SourceText 不可调试。 如果将无 SourceText 编码写入文件 UTF8 ,则应将它用作默认值。

checksumAlgorithm
SourceHashAlgorithm

用于计算保存到 PDB 的文本校验和的哈希算法。

返回

例外

text 为 null。

不支持 checksumAlgorithm

适用于

From(Stream, Encoding, SourceHashAlgorithm, Boolean)

Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
public:
 static Microsoft::CodeAnalysis::Text::SourceText ^ From(System::IO::Stream ^ stream, System::Text::Encoding ^ encoding, Microsoft::CodeAnalysis::Text::SourceHashAlgorithm checksumAlgorithm, bool throwIfBinaryDetected);
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static Microsoft.CodeAnalysis.Text.SourceText From (System.IO.Stream stream, System.Text.Encoding encoding, Microsoft.CodeAnalysis.Text.SourceHashAlgorithm checksumAlgorithm, bool throwIfBinaryDetected);
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static Microsoft.CodeAnalysis.Text.SourceText From (System.IO.Stream stream, System.Text.Encoding? encoding, Microsoft.CodeAnalysis.Text.SourceHashAlgorithm checksumAlgorithm, bool throwIfBinaryDetected);
[<System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)>]
static member From : System.IO.Stream * System.Text.Encoding * Microsoft.CodeAnalysis.Text.SourceHashAlgorithm * bool -> Microsoft.CodeAnalysis.Text.SourceText
Public Shared Function From (stream As Stream, encoding As Encoding, checksumAlgorithm As SourceHashAlgorithm, throwIfBinaryDetected As Boolean) As SourceText

参数

stream
Stream
encoding
Encoding
checksumAlgorithm
SourceHashAlgorithm
throwIfBinaryDetected
Boolean

返回

属性

适用于

From(TextReader, Int32, Encoding, SourceHashAlgorithm)

Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs

从字符串中的文本构造一个 SourceText

public static Microsoft.CodeAnalysis.Text.SourceText From (System.IO.TextReader reader, int length, System.Text.Encoding encoding = default, Microsoft.CodeAnalysis.Text.SourceHashAlgorithm checksumAlgorithm = Microsoft.CodeAnalysis.Text.SourceHashAlgorithm.Sha1);
public static Microsoft.CodeAnalysis.Text.SourceText From (System.IO.TextReader reader, int length, System.Text.Encoding? encoding = default, Microsoft.CodeAnalysis.Text.SourceHashAlgorithm checksumAlgorithm = Microsoft.CodeAnalysis.Text.SourceHashAlgorithm.Sha1);
static member From : System.IO.TextReader * int * System.Text.Encoding * Microsoft.CodeAnalysis.Text.SourceHashAlgorithm -> Microsoft.CodeAnalysis.Text.SourceText
Public Shared Function From (reader As TextReader, length As Integer, Optional encoding As Encoding = Nothing, Optional checksumAlgorithm As SourceHashAlgorithm = Microsoft.CodeAnalysis.Text.SourceHashAlgorithm.Sha1) As SourceText

参数

reader
TextReader

TextReader

length
Int32

内容长度 reader

encoding
Encoding

从中读取或要保存到的文件 reader 的编码。 null 如果未指定编码,则为 如果未指定编码,则生成的结果 SourceText 不可调试。 如果将无 SourceText 编码写入文件 UTF8 ,则应将它用作默认值。

checksumAlgorithm
SourceHashAlgorithm

用于计算保存到 PDB 的文本校验和的哈希算法。

返回

例外

reader 为 null。

不支持 checksumAlgorithm

适用于

From(Byte[], Int32, Encoding, SourceHashAlgorithm, Boolean)

Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
public:
 static Microsoft::CodeAnalysis::Text::SourceText ^ From(cli::array <System::Byte> ^ buffer, int length, System::Text::Encoding ^ encoding, Microsoft::CodeAnalysis::Text::SourceHashAlgorithm checksumAlgorithm, bool throwIfBinaryDetected);
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static Microsoft.CodeAnalysis.Text.SourceText From (byte[] buffer, int length, System.Text.Encoding encoding, Microsoft.CodeAnalysis.Text.SourceHashAlgorithm checksumAlgorithm, bool throwIfBinaryDetected);
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static Microsoft.CodeAnalysis.Text.SourceText From (byte[] buffer, int length, System.Text.Encoding? encoding, Microsoft.CodeAnalysis.Text.SourceHashAlgorithm checksumAlgorithm, bool throwIfBinaryDetected);
[<System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)>]
static member From : byte[] * int * System.Text.Encoding * Microsoft.CodeAnalysis.Text.SourceHashAlgorithm * bool -> Microsoft.CodeAnalysis.Text.SourceText
Public Shared Function From (buffer As Byte(), length As Integer, encoding As Encoding, checksumAlgorithm As SourceHashAlgorithm, throwIfBinaryDetected As Boolean) As SourceText

参数

buffer
Byte[]
length
Int32
encoding
Encoding
checksumAlgorithm
SourceHashAlgorithm
throwIfBinaryDetected
Boolean

返回

属性

适用于

From(Stream, Encoding, SourceHashAlgorithm, Boolean, Boolean)

Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs

从流内容构造。SourceText

public static Microsoft.CodeAnalysis.Text.SourceText From (System.IO.Stream stream, System.Text.Encoding encoding = default, Microsoft.CodeAnalysis.Text.SourceHashAlgorithm checksumAlgorithm = Microsoft.CodeAnalysis.Text.SourceHashAlgorithm.Sha1, bool throwIfBinaryDetected = false, bool canBeEmbedded = false);
public static Microsoft.CodeAnalysis.Text.SourceText From (System.IO.Stream stream, System.Text.Encoding? encoding = default, Microsoft.CodeAnalysis.Text.SourceHashAlgorithm checksumAlgorithm = Microsoft.CodeAnalysis.Text.SourceHashAlgorithm.Sha1, bool throwIfBinaryDetected = false, bool canBeEmbedded = false);
static member From : System.IO.Stream * System.Text.Encoding * Microsoft.CodeAnalysis.Text.SourceHashAlgorithm * bool * bool -> Microsoft.CodeAnalysis.Text.SourceText
Public Shared Function From (stream As Stream, Optional encoding As Encoding = Nothing, Optional checksumAlgorithm As SourceHashAlgorithm = Microsoft.CodeAnalysis.Text.SourceHashAlgorithm.Sha1, Optional throwIfBinaryDetected As Boolean = false, Optional canBeEmbedded As Boolean = false) As SourceText

参数

stream
Stream

流。 流必须可寻。

encoding
Encoding

如果流未从指定编码的字节顺序标记开始,则使用的数据编码。 如果未指定,则为 UTF8

checksumAlgorithm
SourceHashAlgorithm

用于计算保存到 PDB 的文本校验和的哈希算法。

throwIfBinaryDetected
Boolean

如果解码的文本至少包含两个连续 NUL 字符,则会引发一个 InvalidDataException

canBeEmbedded
Boolean

如此 如果文本可以传递给 FromSource(String, SourceText) PDB 并嵌入到 PDB 中。

返回

例外

stream 为 null。

stream 不支持阅读或寻求。 不支持 checksumAlgorithm

如果给定编码设置为使用引发解码器作为回退

解码的文本中检测到两个连续的 NUL 字符,并且 throwIfBinaryDetected 为 true。

出现 I/O 错误。

注解

从流的开头读取。 使流保持打开状态。

适用于

From(Byte[], Int32, Encoding, SourceHashAlgorithm, Boolean, Boolean)

Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs
Source:
SourceText.cs

从字节数组构造 a SourceText

public static Microsoft.CodeAnalysis.Text.SourceText From (byte[] buffer, int length, System.Text.Encoding encoding = default, Microsoft.CodeAnalysis.Text.SourceHashAlgorithm checksumAlgorithm = Microsoft.CodeAnalysis.Text.SourceHashAlgorithm.Sha1, bool throwIfBinaryDetected = false, bool canBeEmbedded = false);
public static Microsoft.CodeAnalysis.Text.SourceText From (byte[] buffer, int length, System.Text.Encoding? encoding = default, Microsoft.CodeAnalysis.Text.SourceHashAlgorithm checksumAlgorithm = Microsoft.CodeAnalysis.Text.SourceHashAlgorithm.Sha1, bool throwIfBinaryDetected = false, bool canBeEmbedded = false);
static member From : byte[] * int * System.Text.Encoding * Microsoft.CodeAnalysis.Text.SourceHashAlgorithm * bool * bool -> Microsoft.CodeAnalysis.Text.SourceText
Public Shared Function From (buffer As Byte(), length As Integer, Optional encoding As Encoding = Nothing, Optional checksumAlgorithm As SourceHashAlgorithm = Microsoft.CodeAnalysis.Text.SourceHashAlgorithm.Sha1, Optional throwIfBinaryDetected As Boolean = false, Optional canBeEmbedded As Boolean = false) As SourceText

参数

buffer
Byte[]

编码的源缓冲区。

length
Int32

要从缓冲区读取的字节数。

encoding
Encoding

如果编码的缓冲区未以字节顺序标记开头,则要使用的数据编码。 如果未指定,则为 UTF8

checksumAlgorithm
SourceHashAlgorithm

用于计算保存到 PDB 的文本校验和的哈希算法。

throwIfBinaryDetected
Boolean

如果解码的文本至少包含两个连续 NUL 字符,则会引发一个 InvalidDataException

canBeEmbedded
Boolean

如此 如果文本可以传递给 FromSource(String, SourceText) PDB 并嵌入到 PDB 中。

返回

已解码的文本。

例外

buffer 为 null。

length 数或长于 buffer

不支持 checksumAlgorithm

如果给定编码设置为使用引发解码器作为回退

解码的文本中检测到两个连续的 NUL 字符,并且 throwIfBinaryDetected 为 true。

适用于