社区
LINQ
帖子详情
如何在Linq使用case
zzh198310
2008-01-11 05:38:34
在LINQ语法中如何对于select进行case语法
...全文
675
3
打赏
收藏
如何在Linq使用case
在LINQ语法中如何对于select进行case语法
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
3 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
liuning623
2008-05-12
打赏
举报
回复
我也碰到的同样的问题不知道怎么解决,不过有一个变通的方法,可以自己写一个函数来做处理。
zzh198310
2008-01-14
打赏
举报
回复
你那个只不过是2种解决方法而已。。如果要3种以上的呢???
heguo
2008-01-12
打赏
举报
回复
var q =
from p in db.Products
select new {p.ProductName, Availability =
p.UnitsInStock - p.UnitsOnOrder < 0 ? "Out Of Stock": "In Stock"
};
.net2.0
使用
Linq
,lambada表达式
.net2.0
使用
Linq
,lambada表达式,直接引用
使用
即可,从system.core中抽取的扩展。
Essential
LINQ
LINQ
is one of Microsoft’s most exciting, powerful new development technologies. Essential
LINQ
is the first
LINQ
book written by leading members of Microsoft’s
LINQ
and C# teams. Writing for architects, developers, and development managers, these Microsoft insiders share their intimate understanding of
LINQ
, revealing new patterns and best practices for getting the most out of it. Calvert and Kulkarni begin by clearly explaining how
LINQ
resolves the long-time “impedance mismatch” between object-oriented code and relational databases. Next, they show how
LINQ
integrates querying into C# as a “first-class citizen.” Using realistic code examples, they show how
LINQ
provides a strongly typed, IntelliSense-aware technology for working with data from any source, including SQL databases, XML files, and generic data structures. Calvert and Kulkarni carefully explain
LINQ
’s transformative, composable, and declarative capabilities. By fully illuminating these three concepts, the authors allow developers to discover
LINQ
’s full power. In addition to covering core concepts and hands-on
LINQ
development in C# with
LINQ
to Objects,
LINQ
to XML,
LINQ
to SQL, and
LINQ
to Entities, they also present advanced topics and new
LINQ
implementations developed by the
LINQ
community. This book • Explains the entire lifecycle of a
LINQ
project: design, development, debugging, and much more • Teaches
LINQ
from both a practical and theoretical perspective • Leverages C# language features that simplify
LINQ
development • Offers developers powerful
LINQ
query expressions to perform virtually any data-related task • Teaches how to query SQL databases for objects and how to modify those objects • Demonstrates effective use stored procedures and database functions with
LINQ
• Shows how to add business logic that reflects the specific requirements of your organization • Teaches developers to create, query, and transform XML data with
LINQ
• Shows how to transform object, relational, and XML data between each other • Offers best patterns and practices for writing robust, easy-to-maintain
LINQ
code About the Author Charlie Calvert, Community Program Manager for the Microsoft C# team, currently focuses his technical energies on
LINQ
. He has periodically worked with
LINQ
Chief Architect Anders Hejlsberg both during the development of Delphi and during the development of
LINQ
. Calvert’s ten technical books have sold more than 100,000 copies. They include Delphi 4 Unleashed, C++Builder 3 Unleashed, Delphi 2 Unleashed, Teach Yourself Windows 95 Programming in 21 Days, and Teach Yourself Windows Programming. Dinesh Kulkarni is a Senior Program Manager on Microsoft’s .NET Framework team. He was the Program Manager in charge of
LINQ
to SQL. He was deeply involved in
LINQ
’s planning and implementation from the incubation stage and was lead author for MSDN’s authoritative
LINQ
to SQL paper. Before joining Microsoft, he worked in diverse technical roles ranging from architecting and implementing front-end
CASE
tools for IBM to designing databases and middleware for a Wall Street hedge fund. Product Details Paperback: 600 pages Publisher: Addison-Wesley Professional; 1 edition (March 22, 2009) Language: English ISBN-10: 0321564162 ISBN-13: 978-0321564160
C#
LINQ
查询技术
本课程以实例讲解
LINQ
(Language Intergrated Query)语言集成查询技术的
使用
。
Programming Microsoft
LINQ
in Microsoft.NET Framework 4
Book Description The professional programmer’s Deitel® guide to C# 2010 and the powerful Microsoft® .NET 4 Framework Written for programmers with a background in C++, Java or other high-level, object-oriented languages, this book applies the Deitel signature live-code approach to teaching programming and explores Microsoft’s C# 2010 language and .NET 4 in depth. The book is updated for Visual Studio® 2010 and C# 4, and presents C# concepts in the context of fully tested programs, complete with syntax shading, detailed line-by-line code descriptions and program outputs. The book features 200+ C# applications with 17,000+ lines of proven C# code, as well as hundreds of programming tips that will help you build robust applications. Start with a concise introduction to C# fundamentals using an early classes and objects approach, then rapidly move on to more advanced topics, including multithreading, .NET 4,
LINQ
, WPF, ASP.NET 4, WCF web services and Silverlight®. Along the way you’ll enjoy the Deitels’ classic treatment of object-oriented programming and the OOD/UML® ATM
case
study, including a complete C# implementation. When you’re finished, you’ll be ready to build next-generation Windows applications, web applications and web services. Check out the related LiveLessons video product, C# 2010 Fundamentals: Parts I, II and III, containing 20+ hours of video synchronized to this book: www.deitel.com/livelessons. Practical, example-rich coverage of: .NET 4, Types, Arrays, Exception Handling
LINQ
, Object/Collection Initializers OOP: Classes, Objects, Inheritance, Polymorphism, Interfaces WinForms, WPF, XAML, Event Handling WPF GUI/Graphics/Multimedia Silverlight® Lists, Queues, Stacks, Trees Generic Collections, Methods and Classes XML®,
LINQ
to XML Database,
LINQ
to SQL ASP.NET 4.0, ASP.NET AJAX Web Forms, Web Controls WCF Web Services OOD/UML®
Case
Study About the Author Paul Deitel and Harvey Deitel are the founders of Deitel & Associates, Inc., th
LINQ
中
使用
Case
When
select中
使用
case
when
linq
代码: Products.Select(P => new { ID = P.ProductID, Name = P.Name, Color = P.Color, Price = (P.Color == "Red" ? P.StandardCost : (P.Color == "Black" ? P.StandardCost + 10 : P.ListPrice)) }); sql原型: SELECT ProductID, Name, Co
LINQ
8,497
社区成员
4,736
社区内容
发帖
与我相关
我的任务
LINQ
.NET技术 LINQ
复制链接
扫一扫
分享
社区描述
.NET技术 LINQ
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章