我正在寻找一种简单易懂的算法,按字母顺序对C中的字符数组进行排序.
我试图"授权"一些外部表(我不管理)以便在MVC应用程序中使用它,原则上我对尝试(VS2008输出)并不是非常成功:
错误列表 [0错误] [0警告] [1消息]
描述
The table/view 'DATABASE.dbo.table' does not have a primary key defined and no valid primary key could be inferred.
This table/view has been excluded. To use the entity you will need to review your schema, add the correct keys and uncomment it.
Run Code Online (Sandbox Code Playgroud)
文件
C:\Documents and Settings\%USERNAME%\My Documents\Visual Studio 2008\Projects\MVC_Entity_Test\MVC_Entity_Test\Models\EmployeesDataModel.edmx
Run Code Online (Sandbox Code Playgroud)
线
0
Run Code Online (Sandbox Code Playgroud)
柱
1
Run Code Online (Sandbox Code Playgroud)
项目
MVC_Entity_Test
Run Code Online (Sandbox Code Playgroud)
产量
显示输出:实体数据模型
Added the connection string to Web.Config.
Successfully registered the assembly 'System.Data.Entity, Version=3.5.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089' in Web.Config.
The model …Run Code Online (Sandbox Code Playgroud) sql-server asp.net-mvc entity-framework primary-key visual-studio-2008
所以我一直在尝试MVVM在WPF具有以下结构的简单应用程序中实现该模式:
模型
public class Foobar
{
public string Foo { get; set; }
public string Bar { get; set; }
public string DoSomethingWithFoo()
{
return "The quick brown fox";
}
public string DoSomethingWithBar()
{
return "jumps over the lazy dog.";
}
}
Run Code Online (Sandbox Code Playgroud)
查看模型(基础)
public abstract class ViewModel : INotifyPropertyChanged
{
[Conditional("DEBUG")]
[DebuggerStepThrough]
public void VerifyPropertyName(string propertyName)
{
if (TypeDescriptor.GetProperties(this)[propertyName] == null)
{
Debug.Fail("Invalid property name: " + propertyName);
}
}
protected virtual void OnPropertyChanged(string propertyName)
{ …Run Code Online (Sandbox Code Playgroud) 我感觉很困惑的方式或者C#的foreach和Java的的增强的作品,甚至更令人沮丧的是明白为什么我还没有碰到过这个细节来之前.
但无论如何,事实上,我真的很想理解为什么这个看似相似的流控制语句的工作方式如此不同.为了便于说明,我们假设我们需要迭代一个整数数组,两个实现都是这样的:
C#4.0(代码)
class Program
{
public static void Main(string[] args)
{
int[] foobar = new int[] {0, 1, 1, 2, 3, 5, 8, 13, 21};
Console.WriteLine(String.Format("[DEBUG] type: {0}", foobar.GetType()));
Console.WriteLine(String.Format("[DEBUG] length: {0}", foobar.Length));
try
{
for (int i = 0; i < foobar.Length; i++)
{
Console.Write(String.Format("{0} ", foobar[i]));
}
Console.Write(Environment.NewLine);
foreach (var i in foobar) {
Console.Write(String.Format("{0} ", foobar[i]));
}
}
catch (Exception exception)
{
Console.Write(Environment.NewLine);
Console.WriteLine(exception.ToString());
}
finally
{
Console.Write(Environment.NewLine); …Run Code Online (Sandbox Code Playgroud) c# ×2
arrays ×1
asp.net-mvc ×1
c ×1
character ×1
java ×1
mvvm ×1
primary-key ×1
sorting ×1
sql-server ×1
wpf ×1