小编Dan*_*ner的帖子

拆分字符串,同时保留用引号括起来的值(.NET)

我正在寻找一种方法,在.NET中,分割字符串,同时忽略引号(或另一个分隔符)内的分割字符.(如果拆分分隔符是逗号,则此功能将与典型的CSV解析器的功能相匹配.)我不确定为什么没有内置此功能String.Split().

.net

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

从SharePoint 2010中的列表项上的自定义按钮/操作启动工作流(全部使用Visual Studio 2010)

我很抱歉问了一个双重问题,但我搞砸了找不到解决方案 - 或者对答案缺乏理解.

我的问题就像被描述一样:

我有一些带按钮的自制定制丝带.如果我点击设计按钮,我想开始工作流程.

好的,有关设置的更多信息:

这是一个通用列表,意思是,我的elemets.xml看起来像这样:

<CustomAction
  Id="MyCustomRibbonTab"
  Location="CommandUI.Ribbon.ListView"
  RegistrationId="100"
  RegistrationType="List">
  <CommandUIExtension>
    <CommandUIDefintions>
      <CommandUIDefinition
        Location="Ribbon.Tabs._children">
        <Tab Id="Ribbon.CustomTab" Sequence="501">
        ... (Scaling)
          <Groups Id="Ribbon.CustomTab.Groups">
            <Group 
              Id="Ribbon.CustomTab.GroupOne" 
              Sequence="52">
              <Controls Id="Ribbon.CustomTab.GroupOne.Controls">
                <Button
                  Id="Ribbon.CustomTab.GroupOne.ButtonOne"
                  Command="CustomTab.ButtonOneCommand"
                  Sequence="11">
              </Controls>
            </Group>
          </Groups>
        </Tab>
      </CommandUIDefinition>
    </CommandUIDefinitions>
    <CommandUIHandlers>
      <CommandUIHandler
        Command="CustomTab.ButtonOneCommand"
        CommandAction="javascript:alert('how start workflow here?');" />
        />
    </CommandUIHandlers>
  </CommandUIExtension>
  <!-- what about starting workflow here? How? -->
</CustomAction>
Run Code Online (Sandbox Code Playgroud)

希望很清楚我的XML-Post意味着什么.好吧,如果我把CommandAction ="javascript:alert('应该启动一个工作流程'),这样可以正常工作;" .我的意思是,这个警报弹出,我可以点击好,没别的.

现在我在同一个项目中设计了我的工作流程.有两种类型,一种在asp中有启动形式,另一种没有,都在选定的项目上运行.我可以在使用标准功能区"Workflows"时启动它们,然后单击它们.到目前为止一切都很好.

但我希望通过单击我的按钮来启动每个工作流程,而不是现在的点击次数.谢谢你到目前为止帮助我.

我是SharePoint的新手.所以请在你的答案中包括诸如"添加新的...空元素/ JavaScript文件"之类的内容或者任何必要的内容以获得我所假设的内容.

如果您对我的工作流程设计有更多疑问,我会尽快回答.

非常感谢你,

danbruc

注意:是的,我只是希望即使我的Elements.xml也没问题.我从网上拿走了所有.所以如果你有重新设计的建议,我是开放的.只是盲目地看到解决方案.另外,我可以把这个Tab放在ListView的ContextualTab中,但是后来甚至javascript都无法正常工作.

sharepoint workflow custom-action code-behind

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

如何在C#中创建XML

我需要创建一个XML并将其作为字符串返回.谁能告诉我如何使用创建以下XML XmlDocument

<outputs>
  <output name="" value="" type=""></output>
  <output name="" value="" type=""></output>
  <output name="" value="" type=""></output>
</outputs>
Run Code Online (Sandbox Code Playgroud)

UPDATE

var xmlDocument = new XmlDocument();

            var xmlNode=xmlDocument.CreateNode(XmlNodeType.XmlDeclaration,"outputs","namespace");
            xmlDocument.AppendChild(xmlNode);

            var xmlElement = xmlDocument.CreateElement("", "output", "");
            xmlDocument.AppendChild(xmlElement);
Run Code Online (Sandbox Code Playgroud)

c# xml

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

如何命名界面集合?

情况如下.

public interface IFoo { }

public abstract class FooBase : IFoo { }
Run Code Online (Sandbox Code Playgroud)

现在我需要IFoo一些额外的方法集合.

public class IFooCollection : List<IFoo>
{
   public void UsefullMethod() { }
}
Run Code Online (Sandbox Code Playgroud)

问题是,IFooCollection当它是一个类时看起来像一个接口.选项如下.

  1. 保持它IFooCollection- 我不喜欢这个,因为它看起来像一个界面.
  2. 把它命名FooCollection- 我不喜欢这个,因为它不是foos的集合.
  3. 把它变成FooBaseCollection因为所有的实现IFoo派生自FooBase- 我不喜欢这个,因为这可能永远不会是真的.
  4. 不要创建类,而是提供扩展方法,IList<IFoo>因为只有一个完整的方法 - 我不喜欢这样,因为更改代码因为找不到类的名称...是的,这是令人讨厌的.
  5. 我没有想到或忘记写下来的东西 - 我希望我会喜欢它!

那你会怎么做?我错过了一个命名约定吗?我们基本上使用这个Microsoft .NET库标准.

UPDATE

代码不会变得普遍 - 它只是在GUI工具中将一些数据放入服务器.所以我不关心将这些方法与其他集合一起使用或忽略这些方法.

.net collections interface naming-conventions

0
推荐指数
2
解决办法
276
查看次数

一个数组问题

我下面有一个数组

string stringArray = new stringArray[12];

stringArray[0] = "0,1";
stringArray[1] = "1,3";
stringArray[2] = "1,4";
stringArray[3] = "2,1";
stringArray[4] = "2,4";
stringArray[5] = "3,7";
stringArray[6] = "4,3";
stringArray[7] = "4,2";
stringArray[8] = "4,8";
stringArray[9] = "5,5";
stringArray[10] = "5,6";
stringArray[11] = "6,2";
Run Code Online (Sandbox Code Playgroud)

我需要改变如下

List<List<string>> listStringArray = new List<List<string>>();

listStringArray[["1"],["3","4"],["1","4"],["7"],["3","2","8"],["5","6"],["2"]];
Run Code Online (Sandbox Code Playgroud)

怎么可能?

c# arrays

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

在C#.net中打印二进制文件的时间

我遇到了下一个问题.我有一个二进制文件,我写入系统的重要数据.其中一个字段是时间,我使用DateTime.Now.ToString("HHmmssffffff"),格式为微秒.这个数据(在字符串中)我转换(ToCahrArray)(并在调试中检查它很好),它包括有效时间直到微秒.然后我写它并将其刷新到文件.当用PsPad打开它将二进制转换为Ascii时,我看到数据在这个字段中被破坏而另一个是消息而是消息的其余部分很好.

代码:

void Write(string strData) {
   char[] cD = strData.ToCharArry();
   bw.Write(c); //br is from type of BinaryWriter 
   bw.Flush();
}
Run Code Online (Sandbox Code Playgroud)

.net c#

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

如何与Linq分开?

我在包含状态数据的数据库表中有一列33:Rio de Janeiro.我想33使用LINQ表达式提取代码.这是我的代码.

public string command(string query)
{
    string res = string.Empty;
    MySqlConnection conn = new MySqlConnection(MysqlConnect());
    MySqlCommand cmd = new MySqlCommand(query,conn);
    res = cmd.ExecuteScalar().ToString();
    conn.Close();
    return res;
}
Run Code Online (Sandbox Code Playgroud)

在这里,我想得到州的代码.

string code = db.command("select cidade from logos ")
                .Split(':')
                .Where(<Expression to get the first part>);
Run Code Online (Sandbox Code Playgroud)

请帮我.

c# linq

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