本文整理汇总了C#中System.IO.StreamReader.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# StreamReader.GetType方法的具体用法?C# StreamReader.GetType怎么用?C# StreamReader.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO.StreamReader
的用法示例。
在下文中一共展示了StreamReader.GetType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: leeArchivo
public void leeArchivo()
{
string ubicacion;
try
{
Console.WriteLine("Dame la ubicacion de el arcihvo");
ubicacion = Console.ReadLine();
StreamReader objReader = new StreamReader(ubicacion);
objReader.GetType();
string sLine= objReader.ReadLine();
ArrayList arrText = new ArrayList();
while (sLine != null)
{
agregaResisgtro(sLine);
sLine = objReader.ReadLine();
}
objReader.Close();
}
catch(Exception e)
{
Console.WriteLine("Exception: " + e.Message);
}
finally
{
Console.WriteLine("Cerrando la lectura.");
}
}
示例2: GetCharposMono3
private static long GetCharposMono3(StreamReader s)
{
Int32 charpos = (Int32)s.GetType().InvokeMember("pos",
BindingFlags.DeclaredOnly |
BindingFlags.Public | BindingFlags.NonPublic |
BindingFlags.Instance | BindingFlags.GetField
, null, s, null);
Int32 charlen = (Int32)s.GetType().InvokeMember("decoded_count",
BindingFlags.DeclaredOnly |
BindingFlags.Public | BindingFlags.NonPublic |
BindingFlags.Instance | BindingFlags.GetField
, null, s, null);
return s.BaseStream.Position - charlen + charpos;
}
示例3: GetStreamReaderPreambleSize
private static long GetStreamReaderPreambleSize(StreamReader sr)
{
if (_streamReaderPreambleProperty == null)
{
_streamReaderPreambleProperty = sr.GetType()
.GetProperty("Preamble_Prop",
BindingFlags.Instance | BindingFlags.NonPublic);
}
return ((byte[])_streamReaderPreambleProperty.GetValue(sr)).Length;
}
示例4: GetActualPosition
public long GetActualPosition(StreamReader reader)
{
// The current buffer of decoded characters
char[] charBuffer = (char[])reader.GetType().InvokeMember("charBuffer"
, System.Reflection.BindingFlags.DeclaredOnly | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.GetField
, null, reader, null);
// The current position in the buffer of decoded characters
int charPos = (int)reader.GetType().InvokeMember("charPos"
, System.Reflection.BindingFlags.DeclaredOnly | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.GetField
, null, reader, null);
// The number of bytes that the already-read characters need when encoded.
int numReadBytes = reader.CurrentEncoding.GetByteCount(charBuffer, 0, charPos);
// The number of encoded bytes that are in the current buffer
int byteLen = (int)reader.GetType().InvokeMember("byteLen"
, System.Reflection.BindingFlags.DeclaredOnly | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.GetField
, null, reader, null);
return reader.BaseStream.Position - byteLen + numReadBytes;
}
示例5: GetStreamReaderBufferPos
private static int GetStreamReaderBufferPos(StreamReader sr)
{
if (_streamReaderBufferPositionProperty == null)
{
_streamReaderBufferPositionProperty = sr.GetType()
.GetProperty("CharPos_Prop",
BindingFlags.Instance | BindingFlags.NonPublic);
}
return (int)_streamReaderBufferPositionProperty.GetValue(sr);
}
示例6: GetStreamReaderBufferLength
private static long GetStreamReaderBufferLength(StreamReader sr)
{
if (_streamReaderByteLenProperty == null)
{
_streamReaderByteLenProperty = sr.GetType()
.GetProperty("ByteLen_Prop",
BindingFlags.Instance | BindingFlags.NonPublic);
}
return (int)_streamReaderByteLenProperty.GetValue(sr);
}