SWIG: How to add namespace to generated cs file? - swig

i am using swig to gen c# code, but i don't know how to add a namespace to the output file,
such as:
using System.Text;
using System.IO;
my English is poor, can anyone understand?

Related

VS 2022 c# 'type or namespace name 'DllExport' could not be found'

This is from a c# dll from GitHub that is in use by many people so it should compile but this line
[DllExport(CallingConvention.StdCall)]
gives these errors
Error CS0246 The type or namespace name 'DllExport' could not be found (are you missing a using directive or an assembly reference?)
Error CS0246 The type or namespace name 'DllExportAttribute' could not be found (are you missing a using directive or an assembly reference?)
That is the only line in the code with an error.
using System;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using Windows.Services.Store;
...
[DllExport(CallingConvention.StdCall)]
...
From what I have gathered with your specific line of code there
[DllExport(CallingConvention.StdCall)]
DllExport is a function from the UnmanagedExports library, so you just need to add:
using RGiesecke.DllExport;

What is the naming convention of thrift namespaces if I have a multiword name?

In a thrift file, when I have a multiword namespace such as someAwesomeNamespace, what is the naming conventions to make this as a namespace in a .thrift file?
namespace rb someAwesomeNamespace
namespace rb SomeAwesomeNamespace
namespace rb some_awesome_namespace
namespace rb some-awesome-namespace
Short answer: There is none. Use whatever fits your needs (and what the syntax allows).

.NET Framework name space structure (Directives)

For example "Using System.Console". Here "System" is the namespace and "Console" is the class"
Okay that makes sence but what about directives such as "System.IO.Compression".
In the above example would "Compression" be the method?
In visual studio projects why does the IDE add using system; and then using system.console?
Would using system automatically call all the classes in the namespace anyway making the using system.console redundant?
System, System.Console, System.IO, System.IO.Compression are all namespaces.
namespace System
{
class Foo1{}
namespace Console
{
}
namespace IO
{
class Foo2{}
namespace Compression{}
}
}
Compression namespace is nested inside IO, and all nested inside System
If you Using System, you only can access class Foo1(), in the other words, Using... only access class and variable, not the namespace that nested inside
***EDIT: This article defines quite clearly about namespace: https://msdn.microsoft.com/en-us/library/dfb3cx8s(v=vs.140).aspx

How many namespace are there in salesforce

I know some name of salesforce provided namespace like System, Database, ApexClass, Messaging.
Can anybody give me the list of all Namespace in Salesforce?
There's a list of them in the Apex Developers Guide.
ApexPages Namespace
Approval Namespace
Auth Namespace
Canvas Namespace
ChatterAnswers Namespace
ConnectApi Namespace
Database Namespace
Dom Namespace
Flow Namespace
KbManagement Namespace
Messaging Namespace
Process Namespace
QuickAction Namespace
Reports Namespace
Schema Namespace
Site Namespace
Support Namespace
System Namespace

Database Class Missing for MigratorDotNet

According to the Migrator.net Quick Start Tutorial, I'm supposed to invoke the Database class to invoke the migration, a la Database.CreateTable(...).
Problem is, I don't have any Database class in my project path. Visual Studio can't find it. (I installed this using NuGet, and it included three references: Migrator, Migrator.Framework, and Migrator.Providers.)
What am I missing? Here's a complete class, which looks correct (virtually an exact duplicate of the starter code on their wiki):
using System;
using System.Linq;
using System.Web;
using Migrator.Framework;
using System.Data;
namespace Migrations
{
[Migration(1)]
public class CreateModelTables_001
{
public void Up() {
Database.ExecuteNonQuery("");
}
}
}
Your migration is not extending the Migration class. Database is a member variable. Change your class definition to:
public class CreateModelTables_001 : Migration
And you should be good to go.