当前位置: 首页>>代码示例>>C#>>正文


C# StreamReader.GetType方法代码示例

本文整理汇总了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.");
            }
        }
开发者ID:RexDoniz,项目名称:Practica4,代码行数:31,代码来源:funciones.cs

示例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;
    }
开发者ID:shengqh,项目名称:RCPA.Core,代码行数:16,代码来源:StreamUtils.cs

示例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;
        }
开发者ID:RiaanP72,项目名称:BlueChappie,代码行数:11,代码来源:XmlReaderExtensions.cs

示例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;
        }
开发者ID:umoder,项目名称:essence,代码行数:22,代码来源:Readers.cs

示例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);
        }
开发者ID:RiaanP72,项目名称:BlueChappie,代码行数:11,代码来源:XmlReaderExtensions.cs

示例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);
        }
开发者ID:RiaanP72,项目名称:BlueChappie,代码行数:11,代码来源:XmlReaderExtensions.cs


注:本文中的System.IO.StreamReader.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。