在Visual Studio 2017中找不到system.io.stream

时间:2017-08-14 23:07:13

标签: c# visual-studio-2017 system.io.file

我正在使用Visual Studio 2017社区版。我在制作C#项目时遇到困难,因为我无法使用System.IO.Stream。

<?php

namespace App\Http\Controllers;


use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\NiceAction;

class NiceActionController extends Controller {

    public function getHome() {
        $actions = NiceAction::all();
        return view ('home', ['actions' => $actions]);
    }

    public function getNiceAction ($action, $name = null) {

        if ($name === null ) {
            $name = 'you';
        }
        return view ('actions.nice', [
            'action' => $action,
            'name'=> $name
            ]);
    }

    public function postInsertNiceAction (Request $request) {


        $this->validate($request, [
            'action' => 'required',
            'name' => 'required|alpha',
            'niceness' => 'required|numeric'
        ]);


        $action = new NiceAction();
        $action->name = $request['name'];
        $action->niceness = $request['niceness'];
        $action->save();

        $actions = NiceAction::all();
        return view ('home', ['actions' => $actions]);

    }

    private function transformName($name){
        $prefix = 'KING ';
        return $prefix.strtoupper($name);
    }
}

Here is what it shows

2 个答案:

答案 0 :(得分:3)

命名空间实际上是System.IO 用System.IO替换System.IO.Stream Stream是一个类,而不是命名空间

答案 1 :(得分:2)

C#区分大小写,命名空间为System.IO.Stream

此外,您需要在using语句中包含static,因为Stream是一个类

using static System.IO.Stream;