小编Ser*_*rge的帖子

VBA中未声明的变量去哪里了

我尝试了解一些旧的 VBA 代码的作用(以及如何作用)。

我有一个Sub,并且我有一个未在该Sub中声明的变量。

设置Option ExplicitFalse

我应该将该变量视为全局变量吗?在 VBA 文档中没有找到该信息...

Sub test1()
    x = "test one"
End Sub

Sub test2()
    x = "test2"
    Call test1
    MsgBox (">'" + x + "'<")
End Sub
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

无法导航到未声明变量的定义 在此输入图像描述

excel vba

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

覆盖时保留注释

有没有一种方法(工具或其他东西)允许在从基类继承/重写方法时不重复相同的XML注释?

例如.:

/// <summary>
/// Represent a brand new object in .NET
/// </summary>
public class MyObject : Object
{
    /// <summary>
    /// Copy-Paste the same Xml comment 
    /// like in the base class is boring!
    /// </summary>
    /// <param name="obj">and params too!! ((</param>
    /// <returns>this one too!!! (((</returns>
    public override bool Equals(object obj)
    {
        return base.Equals(obj);
    }
}
Run Code Online (Sandbox Code Playgroud)

.net c# conventions xml-comments

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

在CSS中的文本效果下面的行

我尝试在CSS中实现这样的东西:

在此输入图像描述

文本应在容器为中心,具有背景填充5px 20px"行"横向填充20px...

我尝试使用:: before和:: after元素来实现它,但是输出并不像我需要的那样,请看下面的代码...

Codepen:https://codepen.io/serhio/pen/XRYgxo edit = 1100

header {
  font-weight: bold;
  background: lightblue;
  text-align: center;
  border-radius: 5px;
  display: inline-block;
  padding: 5px 20px;  
}

header::before {
  width: 20px;
  height: 2px;
  background: blue;  
  display: inline-block;
  content: '';
}
header::after {
  width: 20px;
  height: 2px;
  background: red;  
  display: inline-block;
  content: '';
}
Run Code Online (Sandbox Code Playgroud)
<header>Quisque tincidunt</header>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque tincidunt non leo nec posuere. Nunc …
Run Code Online (Sandbox Code Playgroud)

css css3

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

指定"asp-for"HTML标记的格式(ASP.NET Core)

在ASP.NET Core项目中,我必须以特定格式显示(只读)日期(例如"dd/mm/yyyy HH:MM")

<div class="form-group">
    <label asp-for="Date" class="col-md-2 control-label"></label>
    <div class="col-md-10">
        <input asp-for="Date" readonly class="form-control" />
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

我怎么能这样做,因为知道该Date字段是在模型中声明的

public DateTime Date { get { return this.Timestamp.DateTime; } }
Run Code Online (Sandbox Code Playgroud)

c# asp.net-mvc asp.net-core-mvc asp.net-core asp.net-core-1.1

3
推荐指数
3
解决办法
9884
查看次数

转换为'Task'的异步lambda表达式返回委托不能返回值

我在ASP.NET核心应用程序(Startup.cs,Configure方法)中有以下内容:

我刚刚添加了async关键字,因为我需要await一个...所以现在,我得到以下内容:

错误CS8031转换为' Task'返回委托的异步lambda表达式无法返回值.你有意回来' Task<T>'吗?

public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, ITableRepositories repository)
{
    // ...  
    app.UseStaticFiles();    
    app.UseCookieAuthentication();

    app.UseOpenIdConnectAuthentication(new OpenIdConnectOptions
    {
        ClientId = Configuration["..."],
        Authority = Configuration["..."],
        CallbackPath = Configuration["..."],
        Events = new OpenIdConnectEvents
        {
            OnAuthenticationFailed = context => { return Task.FromResult(0); },
            OnRemoteSignOut = context => { return Task.FromResult(0); },
            OnTicketReceived = async context =>
            {
                var user = (ClaimsIdentity)context.Ticket.Principal.Identity;
                if (user.IsAuthenticated)
                {
                    var firstName = user.FindFirst(ClaimTypes.GivenName).Value; …
Run Code Online (Sandbox Code Playgroud)

c# async-await asp.net-core

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

在ConfigureServices中注入依赖项

在我的ASP.Net Core应用程序中,我需要在方法中注入一些依赖项(在我的例子中是一个存储库)ConfigureServices.

问题是该方法不允许使用多个参数来注入依赖项.该怎么做?

这是我的代码

public void ConfigureServices(IServiceCollection services)
{
    services.AddOptions();

    // ... 
    services.AddSingleton<ITableRepositories, TableClientOperationsService>();

    // Add framework services.
    services.AddOpenIdConnect(options =>
    {
        // options.ClientId = ...
        options.Events = new OpenIdConnectEvents
        {
            OnTicketReceived = async context =>
            {
                var user = (ClaimsIdentity)context.Principal.Identity;
                if (user.IsAuthenticated)
                {
                    // ... 
                    // vvv 
                    // HERE, I need the ITableRepositories repository; 
                    // vvv
                    var myUser = await repository.GetAsync<Connection>(userId);
                    // ... 
                }
                return;
            }
        };
    });
}
Run Code Online (Sandbox Code Playgroud)

我怎样才能在这里注入依赖?

编辑:

遵循克里斯的想法(吼叫),这似乎有效:

public class Startup
{
    // private …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-mvc dependency-injection asp.net-core asp.net-core-2.0

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

修复Edge中的Flex显示

我有以下内容:

.flex { display: flex; }
Run Code Online (Sandbox Code Playgroud)
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
                                                                    rel="stylesheet"/>
<div class="flex">
  <input class="form-control" />
  <div class="flex">
    <input class="form-control" value="123456789" />
    <input class="form-control" value="123456789" />
  </div>
</div>
Run Code Online (Sandbox Code Playgroud)

为什么我无法完全在Microsoft Edge中看到最新的输入(即使在IE中也可以),以及如何解决它.

css css3 flexbox twitter-bootstrap-3 microsoft-edge

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

在ASP.NET MVC Core中显示/编辑货币,为什么这么复杂?

在ASP.NET Core 2.0应用程序中,我有一个Foo包含许多经典字符串或数字成员以及int? Budget字段的类.

using Microsoft.AspNetCore.Http;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace MyProj.ViewModels {
    public class RecordEditViewModel {
        public RecordEditViewModel() { }

        public string Name { get; set; }
        public string Prop1 { get; set; }
        public string Prop2 { get; set; }
        public string Prop3 { get; set; }
        public string Prop4 { get; set; }    
        public string Prop5 { get; set; }

        /// <summary>The project budget</summary>        
        //[Range(0, int.MaxValue, ErrorMessage = "Must …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-core asp.net-core-tag-helpers

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

如何在VS 2017中将类图添加到ASP.NET Core项目?

我遵循了如何:将类图添加到项目中,但是在安装ClassDiagram Visual Studio组件后,我的ASP.NET Core项目中没有“类图”模板(安装组件后,我重新启动了Visual Studio):

在此处输入图片说明

Microsoft Visual Studio Enterprise 2017 
Version 15.8.7
VisualStudio.15.Release/15.8.7+28010.2046
Microsoft .NET Framework
Version 4.7.03056

Installed Version: Enterprise

Visual C++ 2017   00369-60000-00001-AA695
Microsoft Visual C++ 2017

ASP.NET and Web Tools 2017   15.8.05085.0
ASP.NET and Web Tools 2017

ASP.NET Core Razor Language Services   15.8.31590
Provides languages services for ASP.NET Core Razor.

ASP.NET Web Frameworks and Tools 2012   4.0.30625.0
For additional information, visit https://www.asp.net/

ASP.NET Web Frameworks and Tools 2017   5.2.60618.0
For additional information, visit https://www.asp.net/

Azure …
Run Code Online (Sandbox Code Playgroud)

.net class-diagram visual-studio asp.net-core visual-studio-2017

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

添加非空列从其他列获取值

我有一个现有的表,Items其中包含Id | CreateDate(作为日期时间)列;要添加,请从列中获取默认年份。Year int not nullCreateDate

Year值将来会更新为不同的值,但只需在添加“年份”列时将其设置为默认值,因为要向“年份”添加不可为空的列。

那可能吗?

sql t-sql sql-server create-table sql-update

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