小编Neo*_*Neo的帖子

我怎么能回归斐波那契系列?我应该使用IList <>吗?

public int Fibonacci(int x)
{        
    int prev = -1;
    int next = 1;
    for (int i = 0; i < x; i++)
    {
        int sum = prev + next;
        prev = next;
        next = sum;
        Console.WriteLine(sum); 
    }
    return sum; // plz teel me how can i return whole list ??
}
Run Code Online (Sandbox Code Playgroud)

如何返回上述系列的整个输出?即如果x = 3然后0 1 1 2那么我该如何归还呢?

c#

1
推荐指数
2
解决办法
5897
查看次数

如何使用ssis将一个值插入两列

我有一个excel file,那是包含price列..

现在我需要将其price插入表中,但同样的价格应插入两列..

例如 :

表:

companyname  initialprice lastprice 
ABC COPR     null         null     
Run Code Online (Sandbox Code Playgroud)

现在我已经使用了excel file source,oledb destination 但我怎样才能将价格映射到initialpricelastprice

ssis

1
推荐指数
1
解决办法
1579
查看次数

如何在MVC中将参数默认为Guid.Empty?

对于Index操作我需要传递Guid,但它应该为null,因为我正在检查它是否有编辑或删除操作.

我使用了这样但得到编译错误:Guid不能为null必须是编译时间常量.或运行时错误:

参数字典在'Mapping.Controllers.HomeController中为方法'System.Web.Mvc.ActionResult Index(System.String,System.Guid)'包含非可空类型'System.Guid'的参数'uid'的空条目. ".可选参数必须是引用类型,可空类型,或者声明为可选参数.

public ActionResult Index(string userAction, Guid uid = new Guid() )
        {
----
----
}
Run Code Online (Sandbox Code Playgroud)

model-view-controller asp.net-mvc asp.net-mvc-3

1
推荐指数
1
解决办法
5338
查看次数

如何在MVC的Homecontroller内部条件下更改提交按钮文本?

我有mvc 3应用程序,其中在Index.cshtml视图上有一种输入形式。也有一个具有的Webgrid editdelete按钮

根据这些操作链接,我需要更改我的提交按钮文本。我如何在homecontroller.cs中实现此目标?只使用一个为所有视图editinsert

检查homecontroller.cs中的useraction

public ActionResult Index(string userAction)
    {
       if (userAction == "Edit" )
        {

        }


        if (userAction == "Delete" )
        {

        }

    }

View code: 
@model Mapping.Models.SecurityIdentifierMappingViewModel
@using (Html.BeginForm())
{
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Mapping</legend>
        <div class="editor-label">
            @Html.Label("Pricing SecurityID")
        </div>
        <div class="editor-field">
            @Html.HiddenFor(model => model.MappingControls.Id)
            @Html.DropDownListFor(model => model.MappingControls.PricingSecurityID,
         new SelectList(Model.PricingSecurities, "Value", "Text"),
         "Select SecurityID"
            )
            @Html.ValidationMessageFor(model => model.MappingControls.PricingSecurityID)
        </div>
        <div class="editor-label">
            @Html.Label("CUSIP ID")
        </div>
        <div class="editor-field">
            @Html.DropDownListFor(model => model.MappingControls.CUSIP,
         new SelectList(Model.CUSIPs, "Value", "Text"), …
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc stored-procedures entity-framework asp.net-mvc-3

1
推荐指数
1
解决办法
7775
查看次数

类是.net中的私有或内部默认值?

可能重复:
为什么Visual Studio默认情况下不创建公共类?

msdn链接告诉我们

http://msdn.microsoft.com/en-us/library/ba0a1yw2.aspx

Class的默认成员可访问性是私有的

请说明默认是内部还是私有?

.net c#

1
推荐指数
1
解决办法
606
查看次数

无法将日期时间格式转换为00:00:00而不是12:00:00?

我知道这可能是重复的,但代码在c#中仍然不适合我.

我想将日期时间格式转换为00:00:00而不是12:00:00

我尝试过

   cmd.Parameters.Add(new SqlParameter("@fromDate", dtFromDate.Date.ToString("yyyy-MM-dd HH:mm:ss")));
Run Code Online (Sandbox Code Playgroud)

但不适合我:(

请纠正我.

c# asp.net-mvc datetime

1
推荐指数
1
解决办法
1407
查看次数

在android应用中单击Webview上的新链接时,每次都需要加载程序

我希望每次单击webview内的任何链接时都显示加载程序。

目前application start只有它显示我loader

使用以下代码

每个负载加载器有时会来一些时间,有时不是,不确定为什么会发生。

// Force links and redirects to open in the WebView instead of in a browser
    mWebView.setWebViewClient(new WebViewClient() {      
            ProgressDialog progressDialog = null;

        //If you will not use this method url links are opeen in new brower not in webview
        public boolean shouldOverrideUrlLoading(WebView view, String url) {    
     if (progressDialog == null) {
                // in standard case YourActivity.this
                progressDialog = new ProgressDialog(MainActivity.this);
                progressDialog.setMessage("Loading...");
                progressDialog.show();
            }          
            view.loadUrl(url);
            return true;
        }

        //Show loader on url …
Run Code Online (Sandbox Code Playgroud)

android webview android-layout android-webview

1
推荐指数
1
解决办法
1708
查看次数

下载文件时如何设置文件名?

我正在使用MVC4。我已经使用以下简单代码动态生成了Excel文件。我的托管在Azure上。

我创建了一个根路径,然后尝试保存该Excel文件。

问题是当我的ActionResult方法响应返回时,它会提供默认弹出窗口以打开文件,但文件名具有GUID而不是我提供的文件名。

Excel文件生成代码:

Microsoft.Office.Interop.Excel.Application xlApp =新的Microsoft.Office.Interop.Excel.Application();

// ...
//Save
        LocalResource resource = RoleEnvironment.GetLocalResource("MyValue");
        string tempPath = resource.RootPath + "DemoFile.xls";
return tempPath;
Run Code Online (Sandbox Code Playgroud)

tempPath返回类似的路径C:\AppData\Local\dftmp\Resources\11a2435c-998c-4fe8-aa55-8bb42455b4ca\directory\DemoFile.xls

下载文件的弹出窗口不会给文件名作为DemoFilegives some GUID为什么这样呢?

在此处输入图片说明

ActionResult 方法代码:

public ActionResult DownloadExcel() {
    string path = ExcelGenerationCode(fileName);
        Stream s = new FileStream(path, FileMode.Open, FileAccess.Read);
        return new FileStreamResult(s, "application/vnd.ms-excel");
    }
Run Code Online (Sandbox Code Playgroud)

也试图给名字属性

public ActionResult DownloadExcel() {
    string path = ExcelGenerationCode(fileName);
        Stream s = new FileStream(path, FileMode.Open, FileAccess.Read);
        return new FileStreamResult(s, "application/vnd.ms-excel")
        {
            FileDownloadName = "myexcelFILE1.xls" …
Run Code Online (Sandbox Code Playgroud)

c# excel azure asp.net-mvc-4

1
推荐指数
1
解决办法
8586
查看次数

如何在实体框架中使用 AddRange 和 SaveChanges 进行批量插入来提高插入速度

我使用实体框架将数据插入 SQL 表中。

对于数量较多的记录,Add()我不再使用 ,AddRange()而是稍后调用SaveChanges()

插入记录仍然花费太多时间 - 有什么解决方案可以提高速度吗?

_Repository.InsertMultiple(deviceDataList);

await _Repository.SaveAsync();

public void InsertMultiple(List<string> deviceDataList)
{
    context.Devices.AddRange(devices);
}
Run Code Online (Sandbox Code Playgroud)

c# entity-framework c#-4.0 entity-framework-6

1
推荐指数
1
解决办法
9770
查看次数

在asp.net文本框中:输入文本,它会立即显示在另一个文本框中

在asp.net文本框中:输入文本,它会立即显示在另一个文本框中

有什么好建议吗?

我需要这个遍布我的网络应用程序所以它应该更轻量级

asp.net textbox

0
推荐指数
1
解决办法
593
查看次数