3
간단한 스톱워치 WPF 응용 프로그램을 만들려고합니다. 여기System.Diagnostics.Stopwatch에 대한 참조를 찾을 수 없습니다.
내가 System.Diagnostics 네임을 사용하고 있지만, 어떤 이유로 나는 Stopwatch
에 액세스 할 수 있으며, 내가 할 수있는
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using System.Diagnostics;
namespace WpfApplication1
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
public stopWatch = new Stopwatch();
private void startTimer()
{
stopWatch.Start();
Dispatcher.BeginInvoke(DispatcherPriority.Render, new ThreadStart(ShowElapsedTime));
}
void ShowElapsedTime()
{
TimeSpan ts = stopWatch.Elapsed;
lblTime.Text = String.Format("{0:00}:{1:00}.{2:00}", ts.Minutes, ts.Seconds, ts.Milliseconds/10);
}
}
}
과 : 여기
내 코드입니다 이 대화에서 System.Diagnostics를 찾을 수 없습니다 :System.Diagnostics.Stopwatch를 사용할 수없는 이유는 무엇이며 System.Diagnostics가 참조 대화 상자에 나타나지 않는 이유는 무엇입니까?
코드는 텍스트입니다. 사진을 복사 할 때 * 텍스트로 * 붙여 넣을 때 훨씬 쉽게 볼 수 있습니다 (사진이 현재 화면에 작아짐). –
'System.Diagnostics'는'System.dll' 내에 있습니다. 나는 빈 콘솔 애플리케이션을 새로 만들어서 거기에 액세스 할 수 있는지 확인합니다. 또한, 당신이 그것을 사용할 수 없다고 말할 때 ... 오류가 무엇입니까? 어떤 오류도 볼 수 없습니다. – Arran
'stopWatch' 필드를 잘못 선언했습니다. 선언 유형을 잊어 버렸습니다. :) 편집 : C#을 구문/Intellisense 검사기 때문에 그것 때문에 너트 갔다. –