«c#» 태그된 질문

C # ( "see sharp"로 발음)은 Microsoft에서 개발 한 높은 수준의 정적으로 형식화 된 다중 패러다임 프로그래밍 언어입니다. C # 코드는 일반적으로 .NET Framework, .NET Core 및 Xamarin을 포함하는 Microsoft의 .NET 도구 및 런타임 제품군을 대상으로합니다. C # 또는 C #의 공식 사양으로 작성된 코드에 대한 질문에이 태그를 사용하십시오.


9
ASP.NET 웹 API에서 다운로드 파일 이름을 설정하는 방법
내 ApiController 클래스에는 서버에서 만든 파일을 다운로드하는 다음과 같은 메서드가 있습니다. public HttpResponseMessage Get(int id) { try { string dir = HttpContext.Current.Server.MapPath("~"); //location of the template file Stream file = new MemoryStream(); Stream result = _service.GetMyForm(id, dir, file); if (result == null) { return Request.CreateResponse(HttpStatusCode.NotFound); } result.Position = 0; HttpResponseMessage …

10
C #을 사용하여 .SQL 스크립트 파일을 실행하는 방법
이 질문에 이미 답변이 되었음에도 불구하고 검색 도구를 사용하여 답변을 찾을 수 없습니다. C #을 사용하여 .sql 파일을 실행하고 싶습니다. sql 파일에는 여러 개의 sql 문이 포함되어 있으며 일부는 여러 줄로 나뉩니다. 파일을 읽고 ODP.NET을 사용하여 파일을 실행하려고 시도했지만 ... ExecuteNonQuery가 실제로이 작업을 수행한다고 생각하지 않습니다. 따라서 프로세스 생성을 통해 …
140 c#  sql  oracle  scripting 

9
MSTest에서 여러 매개 변수로 테스트 방법을 어떻게 실행할 수 있습니까?
NUnit에는 아래와 같은 Values라는 기능이 있습니다. [Test] public void MyTest( [Values(1,2,3)] int x, [Values("A","B")] string s) { // ... } 이는 테스트 방법이 6 번 실행됨을 의미합니다. MyTest(1, "A") MyTest(1, "B") MyTest(2, "A") MyTest(2, "B") MyTest(3, "A") MyTest(3, "B") 지금 MSTest를 사용하고 있지만 여러 매개 변수로 동일한 테스트를 실행할 수 …

12
C #에서 배치 파일 실행
C #에서 배치 파일을 실행하려고하는데 운이 좋지 않습니다. 인터넷에서 여러 가지 예제를 찾았지만 작동하지 않습니다. public void ExecuteCommand(string command) { int ExitCode; ProcessStartInfo ProcessInfo; Process Process; ProcessInfo = new ProcessStartInfo("cmd.exe", "/c " + command); ProcessInfo.CreateNoWindow = true; ProcessInfo.UseShellExecute = false; Process = Process.Start(ProcessInfo); Process.WaitForExit(); ExitCode = Process.ExitCode; Process.Close(); MessageBox.Show("ExitCode: " …


3
전체 오류 메시지를 표시하도록 web.config 파일을 설정하는 방법
Windows Azure에 MVC-3 응용 프로그램을 배포했습니다. 를 통해 내가 그것을 요구하고 그러나 지금 staging url은 저를 보여줍니다 (요청을 처리하는 중에 오류가 발생했습니다.) . 이제 전체 오류 메시지를보고 싶습니다. 기본적으로 보안상의 이유로 인해 숨겨져 있습니다. web.config 파일을 통해이 작업을 수행 할 수 있음을 알고 있습니다. 그러나 어떻게?

5
WebAPI 2의 DefaultInlineConstraintResolver 오류
Web API 2를 사용하고 있으며 로컬 상자에서 IIS 7.5를 사용하여 API 메서드에 POST를 보낼 때 다음 오류가 발생합니다. The inline constraint resolver of type 'DefaultInlineConstraintResolver' was unable to resolve the following inline constraint: 'string'. Line 21: GlobalConfiguration.Configuration.EnsureInitialized(); IIS를 사용하는 API는 없습니다. 그러나 IIS Express를 사용하여 Visual Studio에서 API 프로젝트를 실행하고 …
140 c#  asp.net  api  iis  asp.net-web-api 

20
여러 파일 확장자 searchPattern for System.IO.Directory.GetFiles
여러 파일 확장자를 다음 과 같이 설정하는 구문은 무엇입니까searchPattern 에가 Directory.GetFiles()? 예를 들어 확장자 가 .aspx 및 .ascx 인 파일을 필터링합니다 . // TODO: Set the string 'searchPattern' to only get files with // the extension '.aspx' and '.ascx'. var filteredFiles = Directory.GetFiles(path, searchPattern); 최신 정보 : LINQ는 옵션이 아니며 …


4
HttpClient 요청에 대한 사용자 정의 헤더
HttpClient요청에 커스텀 헤더를 어떻게 추가 합니까? PostAsJsonAsyncJSON을 게시하는 방법을 사용 하고 있습니다. 추가해야 할 맞춤 헤더는 "X-Version: 1" 이것이 내가 지금까지 한 일입니다. using (var client = new HttpClient()) { client.BaseAddress = new Uri("https://api.clickatell.com/"); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "xxxxxxxxxxxxxxxxxxxx"); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); var response = client.PostAsJsonAsync("rest/message", svm).Result; }

8
ToList ()를 호출 할 때 성능에 영향이 있습니까?
를 사용할 때 ToList()고려해야 할 성능 영향이 있습니까? 디렉토리에서 파일을 검색하는 쿼리를 작성했습니다. 이는 쿼리입니다. string[] imageArray = Directory.GetFiles(directory); 그러나 List<>대신 작업을 좋아하기 때문에 ... List<string> imageList = Directory.GetFiles(directory).ToList(); 따라서 이와 같은 변환을 결정할 때 고려해야 할 일종의 성능 영향이 있습니까? 아니면 많은 파일을 처리 할 때만 고려해야합니까? 무시할만한 전환입니까?
139 c#  arrays  performance  list 

2
RegisterStartupScript와 RegisterClientScriptBlock의 차이점은 무엇입니까?
사이의 유일한 차이 RegisterStartupScript와는 RegisterClientScriptBlockRegisterStartupScript 닫는 전에 자바 스크립트를두고 있다는 것입니다 </form>그것은 바로 시작 후 페이지와 RegisterClientScriptBlock 둔다의 태그 <form>페이지 태그? 또한 언제 다른 것을 선택할 것입니까? 문제가 발생한 빠른 샘플 페이지를 작성했는데 왜 정확한지 잘 모르겠습니다. 다음은 aspx 마크 업입니다. <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" …
139 c#  javascript  asp.net  .net 

10
EPPlus의 자동 열 너비
열의 텍스트가 길 때 열을 자동 너비로 만드는 방법은 무엇입니까? 이 코드를 사용합니다 Worksheet.Column(colIndex).AutoFitColumn() 'on all columns' Worksheet.cells.AutoFitColumns() Worksheet.Column(colIndex).BestFit = True 'on all columns' 이 방법들 중 어느 것도 작동하지 않습니다 작동시키는 방법이 있습니까? 참고 : 일부 텍스트는 유니 코드를 사용합니다.
139 c#  .net  vb.net  epplus 


당사 사이트를 사용함과 동시에 당사의 쿠키 정책개인정보 보호정책을 읽고 이해하였음을 인정하는 것으로 간주합니다.
Licensed under cc by-sa 3.0 with attribution required.