this.defaultSku = this.Skus.Values.First()C#转vb.net

afqitx 2013-03-22 08:02:58
this.defaultSku = this.Skus.Values.First<SKUItem>()

转vb.net
 Me.DefaultSku = Me.Skus.Values.First(Of SKUItem)()


其中Skus定义

public Dictionary<string, SKUItem> Skus
{
get
{
return (this.skus ?? (this.skus = new Dictionary<string, SKUItem>()));
}
}
...全文
68 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
gxingmin 2013-03-22
  • 打赏
  • 举报
回复
直接 Me.DefaultSku = Me.Skus.Values.First() 就可以了
 Private _skus As Dictionary(Of String, SKUItem)
    Private DefaultSku As SKUItem

    Public ReadOnly Property Skus As Dictionary(Of String, SKUItem)
        Get
            If (Me._skus Is Nothing) Then
                Me._skus = New Dictionary(Of String, SKUItem)()
            End If
            Return Me._skus
        End Get

    End Property


'调用
Me.DefaultSku = Me.Skus.Values.First()

afqitx 2013-03-22
  • 打赏
  • 举报
回复
引用 1 楼 dongxinxi 的回复:
强类型的集合,泛型参数可以省略,Values也可以用索引访问 你想问什么?
请指点下,谢谢!
afqitx 2013-03-22
  • 打赏
  • 举报
回复
Me.DefaultSku = Me.Skus.Values.First(Of SKUItem)() 这个提示错误: 没有可访问的“First”接受此数目的类型实参,因此重载决策失败。
  • 打赏
  • 举报
回复
强类型的集合,泛型参数可以省略,Values也可以用索引访问 你想问什么?
经典的书要看原版,顺便锻炼一下阅读能力。乃是修道之人必过之途。(CHM版,阅读方便)Beyond Software Architecture: Creating and Sustaining Winning Solutions By Luke Hohmann Publisher : Addison Wesley Pub Date : January 30, 2003 ISBN : 0-201-77594-8 Pages : 352 Copyright Advance praise for Beyond Software Architecture The Addison-Wesley Signature Series Foreword by Martin Fowler Foreword by Guy Kawasaki Preface Acknowledgments Chapter 1. Software Architecture Defining Software Architecture Alternative Thoughts on Software Architecture Why Software Architecture Matters Creating an Architecture Patterns and Architecture Architectural Evolution and Maturation: Features versus Capabilities Architectural Care and Feeding Principles First, Second, and Third Creating Architectural Understanding The Team Chapter Summary Check This Try This Chapter 2. Product Development Primer What Is Product Management? Why Product Management Matters Product Development Processes: Creating Release 1.0 It Isn't Like That The Business Plan Product Development Processes: Creating Release n.n.n Augmenting the Product Development Process Crucial Product Management Concepts Chapter Summary Check This Try This Chapter 3. The Difference between Marketecture and Tarchitecture Who Is Responsible for What? Early Forces in Solution Development Creating Results in the Short Run while Working in the Long Run Projecting the Future Harnessing Feedback Generating Clarity

16,554

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧