System.IO.StringReader.Close C# (CSharp) Method

Close() public method

public Close ( ) : void
return void
        public override void Close()
        {
            Dispose(true);
        }

Usage Example

Exemplo n.º 1
0
    public static T LoadFromTextAsset <T>(TextAsset textAsset, System.Type[] extraTypes = null)
    {
        if (textAsset == null)
        {
            throw new ArgumentNullException("textAsset");
        }

        System.IO.TextReader textStream = null;

        try
        {
            textStream = new System.IO.StringReader(textAsset.text);

            XmlSerializer serializer = new XmlSerializer(typeof(T), extraTypes);
            T             data       = (T)serializer.Deserialize(textStream); //T data = (T)serializer...

            textStream.Close();

            return(data);
        }
        catch (System.Exception exception)
        {
            Debug.LogError("The database of type '" + typeof(T) + "' failed to load the asset. The following exception was raised:\n " + exception.Message);
        }
        finally
        {
            if (textStream != null)
            {
                textStream.Close();
            }
        }

        return(default(T));//return default(T);
    }
All Usage Examples Of System.IO.StringReader::Close