如果我正在类的主体内部进行深入编辑,那么导航到类声明顶部(包含“class ClassName”的行)的最快(即最少的键盘快捷键)方法是什么?
我知道这有点愚蠢,但我正在转换的XML有时会有一个只有单个或双个空格的元素.像这样:
Dim es1 = <Text> </Text>
Run Code Online (Sandbox Code Playgroud)
当我试图得到.Value这个时Dim resultText = es1.Value,它只是一个空字符串.如果元素中有前导和/或尾随空格以及至少一个其他字符,则这不是问题.
反正有强迫.Value给我空白区域,如果那就是全部?
我想创建一个应用方法的FxRule,只有在从特定类调用该方法时才会这样.
注意:我不想只是将规则应用于特定类的方法,我希望能够处理调用其他方法调用其他方法进行装箱的方法.
我想让FxCop报告与拳击方法相关的问题.
以下是我到目前为止的代码:
using System;
using System.Linq;
using Microsoft.FxCop.Sdk;
using System.Collections.Generic;
class CheckUpdatableComponents : BaseIntrospectionRule
{
private string[] MethodsToCheck = new string[] { "BeginDraw", "BeginRun", "Draw", "EndRun", "EndDraw", "Update" };
/// <summary>Gets the base class hooked up.</summary>
public CheckUpdatableComponents()
: base("CheckUpdatableComponents", "FxCopRules.Rules", typeof(CheckUpdatableComponents).Assembly)
{
}
public override ProblemCollection Check(string namespaceName, TypeNodeCollection types)
{
foreach (var type in types.Where(T => IsSubClassOf(T, "Microsoft.Xna.Framework.Game")))
{
foreach (var MethodToCheck in MethodsToCheck)
{
Method RunMethod = type.GetMethod(Identifier.For(MethodToCheck));
if (RunMethod != null)
{
Visit(RunMethod);
} …Run Code Online (Sandbox Code Playgroud) 如何执行以下联接以返回有权访问公司ID的公司的用户.问题是在UserAccess和User之间没有使用User对象的明确关系,他们只是加入字符串属性Username:
User(Username, Name)
UserAccess(Username, Company)
Company(Id)
Session.QueryOver<Company>()
.Where(c => c.Id == companyId)
.JoinQueryOver<UserCompanyAccess>(u => u.UserAccessList)
.JoinQueryOver<User>(u => **Nope no property, just a string**
Run Code Online (Sandbox Code Playgroud) 我有一个带有多个功能区的 Excel 插件,一个功能区是设置窗口。单击它时,将显示一个自定义窗口。但是,单击时没有任何显示。我在日志文件中看到以下异常。是什么原因导致这种情况以及如何解决?多谢
2012-04-09 09:59:50,161 [1] 错误助手 [(null)] - Name:TypeInitializationException 消息:“System.Windows.Window”的类型初始值设定项引发异常。 目标:Void .ctor() 堆栈:在 System.Windows.Window..ctor() 在 MyShared.View.ConnectionSetup..ctor() 在 MyAddIn.Connect.GetSettings() 在 MyAddIn.Connect.BtnClick(IRibbonControl 控件) 名称:类型初始化异常 消息:“System.Windows.FrameworkElement”的类型初始值设定项引发异常。 目标:Void .cctor() 堆栈:在 System.Windows.Window..cctor() 名称:类型初始化异常 消息:“System.Windows.Documents.TextElement”的类型初始值设定项引发异常。 目标:Void .cctor() 堆栈:在 System.Windows.FrameworkElement..cctor() 名称:类型初始化异常 消息:“MS.Internal.FontCache.Util”的类型初始值设定项引发异常。 目标:Int32 get_Dpi() 堆栈:在 MS.Internal.FontCache.Util.get_Dpi() 在 System.Windows.SystemFonts.ConvertFontHeight(Int32 高度) 在 System.Windows.Documents.TextElement..cctor() 名称:UriFormatException 消息:无效的 URI:无法确定 URI 的格式。 目标:Void CreateThis(System.String, Boolean, System.UriKind) 堆栈:在 System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind) 在 System.Uri..ctor(String uriString, UriKind uriKind) 在 MS.Internal.FontCache.Util..cctor()
编辑,这里是xaml代码
<Window x:Class="MyShared.View.ConnectionSetup"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:toolkit="http://schemas.microsoft.com/wpf/2008/toolkit"
xmlns:Converter="clr-namespace:MIMICShared.Converter"
WindowStartupLocation="CenterOwner"
Title="Settings" Width="446" Height="650" Closing="WindowClosing" …Run Code Online (Sandbox Code Playgroud) 我们一直在研究使用新的Fakes框架来帮助我们提高在.net 4.0框架下运行的一些遗留代码的测试覆盖率.不幸的是,似乎我们无法升级到.net 4.5.我是否正确地说我们不能将Fakes框架与.net 4.0(和VS2012)一起使用,而我们需要使用现在不支持的Moles框架?
我有一些逻辑上相关的独立进程(但是所有进程都是单独启动的-没有通用的“父”进程)。
是否可以使它们在Windows任务栏中显示为一组?
这是雷米(Remy)的答案启发的一些工作代码
using System;
using System.Runtime.InteropServices;
using System.Security;
namespace ConsoleApplication1
{
[SuppressUnmanagedCodeSecurity]
internal static class SafeNativeMethods
{
[DllImport("shell32.dll")]
public static extern int SetCurrentProcessExplicitAppUserModelID([MarshalAs(UnmanagedType.LPWStr)] string AppID);
[DllImport("kernel32.dll")]
public static extern bool AllocConsole();
[DllImport("kernel32.dll")]
public static extern bool FreeConsole();
}
internal class Program
{
public static int SetApplicationUserModelId(string appId)
{
// check for Windows 7
Version version = Environment.OSVersion.Version;
if ((version.Major > 6) || (version.Major == 6 && version.Minor >= 1))
return SafeNativeMethods.SetCurrentProcessExplicitAppUserModelID(appId);
return -1;
}
[STAThread]
public static void …Run Code Online (Sandbox Code Playgroud) 是否有Visual Studio的扩展,可以为解决方案创建类似"卸载的项目配置文件"的内容?
我有一个包含大量项目的解决方案(~100).在处理某个部分时,我可以卸载不相关的项目以提高性能.我希望能够保存这组卸载的项目,这样当我切换到不同的部分工作时,我可以改为加载它的项目.
我正在创建Windows服务并使用C#。我想从服务中打开cmd.exe。我的操作系统是Windows8。是否可以从Windows服务中获取,或者是否还有其他选择。
(我想在一定间隔后打开cmd.exe-这就是为什么我选择Windows服务的原因)
我正在尝试使用date一步保存变量名称。但是,在后面的步骤中,它似乎是未定义的(或空的?)。我在这里缺少什么?
jobs:
# Create release branch for the week
branch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Format the date of next Tuesday
id: tuesday
run: echo "abbr=$(date -v+tuesday +'%y%m%d')" >> $GITHUB_ENV
- name: Create a branch with next tuesday's date
uses: peterjgrainger/action-create-branch@v2.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
branch: release/${{ steps.tuesday.outputs.abbr }}
Run Code Online (Sandbox Code Playgroud)
错误:
refs/heads/release/ is not a valid ref name.
Run Code Online (Sandbox Code Playgroud) .net ×4
c# ×3
class ×1
excel-addins ×1
fxcop ×1
join ×1
linq-to-xml ×1
moles ×1
navigation ×1
nhibernate ×1
queryover ×1
taskbar ×1
vb.net ×1
whitespace ×1
winapi ×1
window ×1
wpf ×1
xelement ×1