LINQ 의 유연함

December 26, 2007 23:49 by WebStoryMaker

Visual Studio 2008 에서 새롭게 선보이고 있는 (.NET Framework 3.5 인 C# 3.0 과 VB9) LINQ (Language INtegrated Query)에 대해 흔히 들어본 일이 있을 것이다. LINQ 가 SQL 을 대체하는 언어로 생각을 하기 쉽상인데 사실 LINQ 는 SQL 외에도 유용하게 쓰일 수 있다.

실례로 2.0에서 다음과 같은 코드를 생각할 수 있다.

foreach (Control myControl in this.Controls)
{
      if(myControl is TextBox)
      {
         myControl.Enabled = false;
      }
}

위의 코드는 페이지에 TextBox 콘트롤을 Disable 시키는 코드이다. 보시다시피 모든 콘트롤을 foreach 루프를 통해 검색을 해야 하는 단점을 지니고 있다. 이러한 코드를 LINQ 는 개선 시킬 수 있다.

var myTextBoxes = from myControl in this.Controls
where myConrol is TextBox
select myControl;

foreach (TextBox myTextBox in myTextBoxes)
{
       myTextBox.Enabled = false;
}

코드는 더 길어졌지만 불필요한 검색을 제거했으므로 더 효율적으로 사용할 수 있음을 알 수 있다.


Currently rated 4.0 by 1 people

  • Currently 4/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags:
Categories: LINQ
Actions: E-mail | Permalink | Comments (0) | Comment RSSRSS comment feed

BlogEngine .NET 1.3 릴리즈소식

December 26, 2007 20:59 by WebStoryMaker

크리스마스 선물인 양 22일 BlogEngine .NET 1.3 이 릴리즈 되었다.

다운로드 바로가기

블로그엔진 1.3 버전에서 아래와 같은 새로운 기능들이 추가되었다.

  • An extension manager that lets you disable and change settings for extensions

  • Extended Windows Live Writer support for posts and pages

  • Mobile devices get special output tailored for small screens

  • Improved user and role management from the admin

  • Non-admin users can only edit and delete their own posts

  • The blog import tool now works with BlogML, RSS and ATOM

  • Granular control over trackbacks and pingbacks

  • User control injection with properties

  • Related posts now also shows related pages

  • New navigational links added to the top of posts

  • More informative e-mails sent when a comment is added

  • Mono is now fully supported out of the box

기존 1.2 사용자들이 1.3 버전으로 업그레이드 하려면 App_Data 폴더 외의 모든 파일들과 폴더들을 덮어씌우기 하면 된다.


Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Sponsors