Params IEnumerable<T> c#
-
22-09-2019 - |
문제
Why cant I use an IEnumerable with params? Will this ever be fixed? I really wish they would rewrite the old libraries to use generics...
해결책
페이지의 UI 버전을 확인 했습니까?
PowerShell에서 UI 버전을 3에서 4에서 수동으로 변경할 수 있습니다. 이것은 SPWeb
와 동일한 방식으로 수행되지만 양식은 양식 라이브러리의 SPFile
객체가됩니다.
SPFile.UIVersion
속성 Visual Upgrade 관리 (SharePoint Server 2010) 편집 :
이를 수정하려면 몇 가지 옵션이 있습니다.
양식이 사용자 정의되었고 그보기를 유지하고 싶다면 다음과 같이하십시오 :
1) SPD에서 각 양식을 열고 양식이 원하는 방식으로 되돌릴 때까지 편집하십시오.
기본 SharePoint 양식으로 되돌리려면
2) SPD에서 사이트로 이동하고 모든 파일을 클릭하고 목록으로 이동하십시오. 파일 아이콘에 파란색 / 흰색 느낌표가있는 경우 마우스 오른쪽 버튼을 클릭하고 "사이트 정의로 재설정"을 선택할 수 있습니다.
3) 브라우저에서 목록> 목록 설정 (목록 탭 아래의 리본에서)> 양식 설정> "기본 SharePoint 양식 사용"을 탐색하십시오.
![]()
다른 팁
Ah, I think I may now have understood what you mean. I think you want to be able to declare a method like this:
public void Foo<T>(params IEnumerable<T> items)
{
}
And then be able to call it with a "normal" argument like this:
IEnumerable<string> existingEnumerable = ...;
Foo(existingEnumerable);
or with multiple parameters like this:
Foo("first", "second", "third");
Is that what you're after? (Noting that you'd want the first form to use T=string
, rather than T=IEnumerable<string>
with a single element...)
If so, I agree it could be useful - but it's easy enough to have:
public void Foo<T>(params T[] items)
{
Foo((IEnumerable<T>) items);
}
public void Foo<T>(IEnumerable<T> items)
{
}
I don't find I do this often enough to make the above a particularly ugly workaround.
Note that when calling the above code, you'll want to explicitly specify the type argument, to avoid the compiler preferring the params
example. So for example:
List<string> x = new List<string>();
Foo<string>(x);
인증은 웹 응용 프로그램 수준에서만 관리됩니다.전체 응용 프로그램이 이러한 공급자를 지원하지 않는 한 동일한 웹 응용 프로그램 내의 사이트가 다른 인증 공급자를 사용하는 것은 불가능합니다.
이 기사에서는 도움이 될 것입니다 : http://msdn.microsoft.com/en-us / library / hh237665.aspx